Hash的应用

思路:此题比较简单,直接贴代码

#include <stdio.h>

int main(){
    int N;
    while( scanf("%d",&N) != EOF && N!=0){
        int buf[101]={0};
        for(int i=0;i<N;i++){
            int x;
            scanf("%d",&x);
            buf[x]++;
        }
        int x;
        scanf("%d",&x);
        printf("%d\n",buf[x]);
    }
    return 0;
}

 

posted @ 2018-01-13 15:08  思丿无邪  阅读(81)  评论(0编辑  收藏  举报