-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangryprofessor.java
50 lines (41 loc) · 1.08 KB
/
angryprofessor.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
45
46
47
48
49
50
/* AUTHOR: Khaled Mohammad
* DATED: October 22, 2016.
* git: https://github.com/itskhaledmohammad
* twitter: https://twitter.com/itskhaledmd (@itskhaledmd)
*
* It is a programming contest practice problem from HackerRank.
* Link to Problem: https://www.hackerrank.com/challenges/angry-professor
*
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
// Initialization
int n = 0, k = 0, a = 0, t = 0, totalStudent = 0;
Scanner sn = new Scanner(System.in);
// Getting the value of t.
t = sn.nextInt();
// Taking n number of cases.
for(int i = 0; i < t; i++){
// Taking the value of n and k.
n = sn.nextInt();
k = sn.nextInt();
totalStudent = 0;
// Checking number of students present in class on time.
for(int j = 0; j < n; j++){
a = sn.nextInt();
if(a <= 0){
totalStudent++;
}
}
// Printing the result.
if(totalStudent < k){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}