HDU1235 统计同成绩学生人数

来源:互联网 发布:手机淘宝发链接给别人 编辑:程序博客网 时间:2024/06/04 18:57

统计同成绩学生人数

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 13735    Accepted Submission(s): 8033


Problem Description
读入N名学生的成绩,将获得某一给定分数的学生人数输出。
 

Input
测试输入包含若干测试用例,每个测试用例的格式为


第1行:N
第2行:N名学生的成绩,相邻两数字用一个空格间隔。
第3行:给定分数

当读到N=0时输入结束。其中N不超过1000,成绩分数为(包含)0到100之间的一个整数。
 

Output
对每个测试用例,将获得给定分数的学生人数输出。
 

Sample Input
380 60 9060285 660560 75 90 55 75750
 

Sample Output
102
Hint
Hint
Huge input, scanf is recommended.
 

Source
浙大计算机研究生复试上机考试-2006年  

#include <stdio.h>#include <string.h>#define maxn 102int arr[maxn];int main(){    int n, m;    while(scanf("%d", &n), n){        memset(arr, 0, sizeof(arr));        while(n--){            scanf("%d", &m);            ++arr[m];        }        scanf("%d", &m);        printf("%d\n", arr[m]);    }    return 0;}


0 0
原创粉丝点击