飞步无人驾驶2018届校园招聘在线笔试A轮 register

Ended

Participants:152

Verdict:Time Limit Exceeded
Score:30 / 100
Submitted:2018-10-06 19:55:19

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
import java.util.Scanner;
public class Main {
    public static void main(String []args) {
        
        int r=-1,k=0;
        Scanner scanner = new Scanner(System.in);
        int n=scanner.nextInt();
        k=scanner.nextInt();
        r=n;
        int list[]=new int[n];
        while(n!=0) {
            list[r-n]=scanner.nextInt();
            n--;
        }
        double sum=0;
        for (int i = 0i < list.lengthi++) {
            for (int j = 0j < list.length-ij++) {
                sum += list[i+j];
                if (sum<k) {
                    n++;
                }
            }
            sum =0;
        }
        
        System.out.print(n);
    }
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX