http://acm.hdu.edu.cn/showproblem.php?pid=1235
以分数为路径存储,传说中的哈希思想。
水题一道~。
#include <iostream>
using namespace std;
#define N 105
int score[N];
int main(){
#ifndef ONLINE_JUDGE
freopen("1235in.txt","r",stdin);
#endif
int n,i,t;
while (scanf("%d",&n)!=EOF&&n){
memset(score,0,sizeof(score));
for (i=0;i<n;i++){
scanf("%d",&t);
score[t]++;
}
scanf("%d",&t);
printf("%d\n",score[t]);
}
return 0;
}
本文介绍了一道使用哈希思想解决分数路径问题的水题。通过输入数据计算特定分数出现的次数,并输出结果。
1万+

被折叠的 条评论
为什么被折叠?



