Practice for Microsoft 2015 Online Test register

Ended

Participants:1406

Verdict:Accepted
Score:100 / 100
Submitted:2014-10-18 12:42:17

Lang:Java

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
public class Main {
    public static void main(String[] args){
        java.util.Scanner input = new java.util.Scanner(System.in);
        int T = input.nextInt();
        for(int i = 0i < Ti++){
            int N = input.nextInt();
            int M = input.nextInt();
            if(M >= N){
                for(int j = 0j < Nj++){
                    input.nextInt();
                }
                System.out.println(100);
            }
            else{
                int[] lazy = new int[N + 2];
                int jmaxDays = 0;
                lazy[0= 0;
                for(j = 1j <= Nj++){
                    lazy[j= input.nextInt();
                }
                lazy[N + 1= 100;
                for(j = 1j <= N - Mj++){
                    maxDays = Math.max(maxDayslazy[j + M- lazy[j - 1- 1);
                }
                System.out.println(maxDays);
            }
        }
    }
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX