讀入N名學生的成績,將獲得某一給定分數的學生人數輸出。
輸入:
測試輸入包含若干測試用例,每個測試用例的格式爲
第1行:N
第2行:N名學生的成績,相鄰兩數字用一個空格間隔。
第3行:給定分數
當讀到N=0時輸入結束。其中N不超過1000,成績分數爲(包含)0到100之間的一個整數。
輸出:
對每個測試用例,將獲得給定分數的學生人數輸出。
樣例輸入:
3
80 60 90
60
2
85 66
0
5
60 75 90 55 75
75
0
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
int main()
{
int N;
multiset<int> IntSet;
while(cin >> N && N != 0)
{
for(int i = 0; i < N; ++i)
{
int tmp;
cin >> tmp;
IntSet.insert(tmp);
}
int number;
cin >> number;
cout << IntSet.count(number) << endl;
IntSet.clear();
}
return 0;
}