1. 程式人生 > >HDU - 1235 統計同成績學生人數 桶排序

HDU - 1235 統計同成績學生人數 桶排序

http://acm.hdu.edu.cn/showproblem.php?pid=1235

#include<iostream>
#include<cstring>
using namespace std;
int a[101];
int main(){
	int n;
	while(scanf("%d",&n)!=EOF && n ){
		memset(a,0,sizeof(a));
		int f,x;
		for(int i=0;i<n;i++){
			scanf("%d",&x);
			a[x]++;
		}
		scanf("%d",&f);
		printf("%d\n",a[f]); 
	} 
} 

tips:

1.多組資料,記得清空陣列!!!