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

Ended

Participants:152

Verdict:Time Limit Exceeded
Score:30 / 100
Submitted:2018-10-06 20:40:45

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.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] inputVec = new int[n];
        for (int i = 0i < ni++) {
            inputVec[i= sc.nextInt();
        }
        int result = 0;
        for (int i = 0i < ni++) {
            for (int j = 0j < (n-i); j++) {
                int[] arr = new int[i+1];
                for (int j2 = 0j2 <= ij2++) {
                    arr[j2= inputVec[j+j2];
                }
                Arrays.sort(arr);
                int mid = (arr.length+1)/2;
                if(arr[mid-1== k){
                    result++;
                }
//              System.out.println(Arrays.toString(arr));
            }
        }
        System.out.println(result);
    }
    
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX