forked from adityabisoi/ds-algo-solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
solution.java
44 lines (37 loc) · 1.06 KB
/
solution.java
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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int T = scanner.nextInt();
for (int t = 0;t<T;t++) {
//taking inputs
int N = scanner.nextInt();
int K = scanner.nextInt();
/*
initialise number of students on time to zero
*/
int cnt = 0;
for (int i = 0;i<N;i++) {
int a = scanner.nextInt();
//increament if arrived at time
if (a <= 0) {
cnt++;
}
}
/*
if number of students arrived at time
is greater than k class not cancelled
*/
if (cnt < K) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
scanner.close();
}
}