MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Hackerrank_problems/Angry Professor/solution.cpp:4–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2using namespace std;
3
4int main() {
5 int T;
6 cin >> T;
7 int x;
8 int N, k, sum;
9 for (int i = 0; i < T; i++) {
10 sum = 0;
11 cin >> N >> k;
12 for(int i = 0; i < N; i++) {
13 cin >> x;
14 // if negative then add to sum
15 if (x <= 0) {
16 sum++;
17 }
18 }
19 // if sum<k the class gets cancelled
20 if (sum < k) {
21 cout << "YES" << endl;
22 }
23 // else class has to be attended
24 else {
25 cout << "NO" << endl;
26 }
27 }
28 return 0;
29}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected