Topic 1018: Statistics on the number of students with grades
time limit:1 seconds
Memory limit:32 MB
Special question: No
submitted:10803
Resolution:5662
-
Title Description:
-
reading the scores of n students, the number of students will be output for a given score.
-
Input:
-
The test input contains several test cases, each of which is in the format
Line 1th: N
Line 2nd: The results of n students, two adjacent numbers with a space interval.
Line 3rd: given score
The input ends when the n=0 is read. where n is not more than 1000, the score is (contains) an integer between 0 and 100.
-
Output:
-
for each test case, you will get the student number output for a given score.
-
Sample input:
-
380 60 9060285 660560 75 90 55 75750
-
-
Sample output:
-
102
#include <iostream>#include<iostream>#include<stdio.h>#include<string.h>#include<stdlib.h>#include<algorithm>using namespacestd;intMain () {intN; while(SCANF ("%d", &n)!=eof&&N) {inthash[101]={0}; while(n--) { intx; scanf ("%d",&x); HASH[X]++; } intx; scanf ("%d",&x); printf ("%d\n", hash[x]); } return 0;}
Topic 1018: Statistics on the number of students with grades