题目链接:http://vjudge.net/problem/HDU-1235
遍历检查就可以,水过。
1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <iostream> 5 #include <algorithm> 6 #include <string> 7 #include <cstdlib> 8 9 using namespace std; 10 11 int main() 12 { 13 int n,i,grade[10010],aim,cnt; 14 while(~scanf("%d",&n)&&n) 15 { 16 cnt=0; 17 for(i=1;i<=n;i++) 18 scanf("%d",&grade[i]); 19 scanf("%d",&aim); 20 for(i=1;i<=n;i++) 21 if(aim==grade[i]) cnt++; 22 printf("%d ",cnt); 23 } 24 return 0; 25 }