HDOJ_1235_统计同成绩学生人数
AC代码:
#include <iostream> #include <cstdio> #define Max 1005 using namespace std; int a[Max]; int main(void) { freopen("in.txt","r",stdin); int n; while(scanf("%d",&n)!=EOF&&n) { int temp,count=0; for(int i=1;i<=n;i++) scanf("%d",&a[i]); scanf("%d",&temp); for(int i=1;i<=n;i++) { if(temp==a[i]) count++; } printf("%d\n",count); } fclose(stdin); system("pause"); return 0; }