Practice for Microsoft 2015 Online Test register

Ended

Participants:1406

Verdict:Accepted
Score:100 / 100
Submitted:2014-10-18 12:16:31

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
30
31
import java.util.*;  
import java.io.*;  
  
  
public class Main{  
    static Scanner cin ;  
    public static void main(String[] args)throws Exception{  
        cin = new Scanner(System.in);  
        //cin = new Scanner(new FileInputStream("in.txt"));  
        int cases = cin.nextInt();  
        while((cases--!= 0){  
            int n = cin.nextInt();  
            int m = cin.nextInt();  
            if(n == 0){  
                System.out.println(100);  
                continue;  
            }  
            int[] point = new int[n];  
            int ans = 0;  
            for(int i = 0i < n++i){  
                point[i= cin.nextInt();  
//              System.out.print(point[i] + " ");  
            }// System.out.println();     
              
            if(n <= m){  
                ans = 100;  
            }  
            else{  
                ans = point[m- 1;  
                for(int i = m + 1i < n++i){  
                    if(ans < point[i- point[i - m - 1]) ans = point[i- point[i - m - 1- 1;   
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX