-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathangry_professor.java
More file actions
48 lines (37 loc) · 1.03 KB
/
angry_professor.java
File metadata and controls
48 lines (37 loc) · 1.03 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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
//solution to: https://www.hackerrank.com/challenges/angry-professor
public class angry_professor {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int test_cases = scan.nextInt();
int count = 0;
while(count < test_cases){
int on_time_count = 0;
int[]classroom = new int[2];
for(int i = 0; i < classroom.length; i++){
classroom[i] = scan.nextInt();
}
int student_no = classroom[0];
int students_needed = classroom[1];
int[]arrival_times = new int[student_no];
for(int j = 0; j < arrival_times.length; j++){
arrival_times[j] = scan.nextInt();
}
for(int k = 0; k <arrival_times.length; k++){
if(arrival_times[k] <= 0){
on_time_count++;
}
}
if(on_time_count < students_needed){
System.out.println("YES");
}else if (on_time_count >= students_needed){
System.out.println("NO");
}
count++;
}
}
}