-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElectionsInChefland.java
More file actions
65 lines (52 loc) · 1.57 KB
/
ElectionsInChefland.java
File metadata and controls
65 lines (52 loc) · 1.57 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
Elections in Chefland
Election season has started in Chefland and the election commission wants to know the count of eligible voters.
There are N people in Chefland where the age of the ith person is Ai.
Given that a person needs to be at least X years old to vote, find the number of eligible voters.
Input Format:
The first line of input will contain a single integer T, denoting the number of test cases.
Each test case consists of multiple lines of input.
The first line of each test case contains two space-separated integers N and X — the number of people in Chefland, and the minimum age required for a person to vote in Chefland.
The next line contains N space-separated integers, where the ith integer denotes the age of the ith person.
Output Format:
For each test case, output on a new line, the number of eligible voters in Chefland.
Constraints:
1 ≤ T ≤ 200
1 ≤ N ≤ 100
1 ≤ Ai, X ≤ 100
Sample Input:
4
4 3
5 3 1 2
3 2
1 3 4
4 2
2 1 2 4
5 6
1 2 3 4 5
Sample Output:
2
2
3
0
*/
import java.util.Scanner;
public class ElectionsInChefland {
public static void main(String[] args) throws java.lang.Exception {
// your code goes here
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
int x = sc.nextInt();
int k = sc.nextInt();
int c = 0;
for (int j = 0; j < x; j++) {
int a = sc.nextInt();
if (a >= k) {
c += 1;
}
}
System.out.println(c);
}
}
}