Count the number of students with the same score Time Limit: 2000/1000 MS (Java/others) memory limit: 65536/32768 K (Java/Others)
Total submission (s): 13735 accepted submission (s): 8033
The Problem description reads the scores of N students and outputs the number of students who have obtained a given score.
The input test input contains several test cases. The format of each test case is
Row 3: N
Row 2nd: scores of N students. Two Adjacent numbers are separated by a space.
Row 3rd: Given score
When n = 0 is read, the input ends. Where n does not exceed 1000, and the score is an integer (including) between 0 and 100.
Output for each test case, the number of students with a given score is output.
Sample Input
380 60 9060285 660560 75 90 55 75750
Sample output
102HintHint Huge input, scanf is recommended.
Source Zhejiang University Computer postgraduate review computer examination-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 ;}
statistics on the number of students with the same score in hdu1235