HackerRank 'Angry Professor' Solution

by Srikant Padala on June 15, 2016, 7:37 am


Explanation


Simply count the number of students coming on or before time


Angry Professor Problem Statement

Video

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int t,count;
    cin >> t;
    for(int a0 = 0; a0 < t; a0++){
        int n;
        int k;
        cin >> n >> k;
        vector<int> a(n);
        count = 0;
        for(int a_i = 0;a_i < n;a_i++){
            cin >> a[a_i];
            if(a[a_i] <= 0) count++;
        }
        if(count >= k) cout << "NO" << endl;
        else cout << "YES" << endl;
    }
    return 0;
}

Coming Soon.