MELIG-LTC2016

MEMBERSHIP ELIGIBILITY– EDITORIAL


Author: bigo_admin

Tester and Editorialist: subhasis10

Problem Links:- Contest
and Practice

DIFFICULTY: CAKEWALK

PREREQUISITES: Array

PROBLEM:

Given an array of integers [A1,A2,…An] representing the points scored by a participant. We need to
check the eligibility of a participant by seeing if he/she solves a minimum number of question within
time.

EXPLANATION:

Here we can conclude that a question is said to be solved in time if the points awarded for it is non-negative i.e. (A[i] >=0). So we traverse through the whole array of points and keep a counter. If the point awarded is non-negative for a question, we increment the counter otherwise we do nothing.
After traversing through the whole array we check if the counter is greater or equal to K, if it satisfies he/she can be a member and print “Yes” otherwise print “No”.

CODE:

#include 
int main()
{
int t;
scanf("%d",&t);
while(t-- )
{
int n,k;
scanf("%d%d",&n,&k);
int cnt = 0 , a;
for(int i=0;i=0) cnt++;
}
if(cnt>=k) printf("Yes\n");
else printf("No\n");
}
return 0;
}