Problem
There were students (numbered through ) participating in the Indian Programming Camp (IPC) and they watched a total of lectures (numbered through ). For each student and each lecture , the -th student watched the -th lecture for minutes.
Additionally, for each student , we know that this student asked the question, "What is the criteria for getting a certificate?" times.
The criteria for getting a certificate is that a student must have watched at least minutes of lectures in total and they must have asked the question no more than times.
Find out how many participants are eligible for a certificate.
Input
- The first line of the input contains three space-separated integers , and .
- lines follow. For each valid , the -th of these lines contains space-separated integers .
Output
Print a single line containing one integer — the number of participants eligible for a certificate.
Constraints
- for each valid
- for each valid and
Sample 1:
4 8 4 1 2 1 2 5 3 5 1 3 4 1 2 4 5 11 1 1 1 3 12
1
Explanation:
- Participant watched minutes of lectures and asked the question times. Since , this participant does not receive a certificate.
- Participant watched minutes of lectures and asked the question times. Since and , this participant receives a certificate.
- Participant watched minutes of lectures and asked the question times. Since but , this participant does not receive a certificate.
- Participant watched minutes of lectures and asked the question times. Since and , this participant does not receive a certificate.Only participant
Program :
#include <stdio.h>
int main(void) {
// your code goes here
int n,m,k,a[1000],q,temp=0;
scanf("%d%d%d",&n,&m,&k);
while (n--)
{
int sum=0;
for (int i=0; i<k;i++)
{
scanf("%d",&a[i]);
sum=sum+a[i];
}
scanf("%d",&q);
if (sum>=m&&q<=10)
{
temp=temp+1;
}
}
printf("%d",temp);
return 0;
}
0 Comments