-
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
-
Source:
- 2006 Zhejiang University computer and software engineering research on the real problem of life test
-
-
Answering:
Problem solving problems? to discuss the subject of discussion please visit: http://t.jobdu.com/thread-7742-1-1.html
#include <iostream>using namespace Std;int main () { int n,a[1000],i,m,count; while (cin>>n&&n!=0) { count=0; for (i=0;i<n;i++) cin>>a[i]; cin>>m; for (i=0;i<n;i++) { if (M==a[i]) count++; } cout<<count<<endl; } return 0;} /************************************************************** problem:1018 user:vhreal language:c++ result:accepted time:10 ms memory:1520 kb******************************************* *********************/
Nine degrees oj-topic 1018: Number of students with statistics