-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangryprofessor.c
44 lines (37 loc) · 1.16 KB
/
angryprofessor.c
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
/* AUTHOR: Khaled Mohammad
* DATED: October 23, 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
*
*/
#include <stdio.h>
#include <stdlib.h>
int main(void){
// Initialization.
int n = 0, k = 0, a = 0, t = 0, totalStudent = 0;
// Getting the value of t.
scanf("%d", &t);
// Taking n number of cases.
for(int i = 0; i < t; i++){
// Taking the value of n and k.
scanf("%d %d", &n, &k);
totalStudent = 0;
// Checking number of students present in class on time.
for(int j = 0; j < n; j++){
scanf("%d", &a);
if(a <= 0){
totalStudent++;
}
}
// Printing the result.
if(totalStudent < k){
printf("YES\n");
}
else{
printf("NO\n");
}
}
}