Practice for Microsoft 2015 Online Test register

Ended

Participants:1406

Verdict:Accepted
Score:100 / 100
Submitted:2014-10-18 13:36:42

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
using namespace std;
int findmax(int b[100],int length, int cardnum)
{
    int k,maxday=b[0],tempmax;
    for(k=0;k<length-cardnum;k++)
    {
        if(k == 1)
            maxday = b[k];
        if(k == length-cardnum-1)
            tempmax = 100 - b[k];
        if(b[k+cardnum+1]-b[k]>maxday)
            maxday = b[k+cardnum+1]-b[k];
    }
    //if(maxday<100-b[k+cardnum]) return 100-b[length-cardnum];
    return maxday>tempmax?maxday:tempmax;
}
int main()
{   
    int columns = 0, a[2][10],i,j,k;
    if(scanf("%d",&columns)!=1)
    return 0;
    int b[100][100];
    for(int x = 0;x<columns;x++)
    {
        scanf("%d%d",&a[0][x],&a[1][x]);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX