码迷,mamicode.com
首页 > 编程语言 > 详细

算法初步——哈希表B.1038统计同成绩学生

时间:2020-01-06 14:58:03      阅读:106      评论:0      收藏:0      [点我收藏+]

标签:color   names   哈希表   math   alt   scan   span   lse   初步   

技术图片

 

 

#include <bits/stdc++.h>
#include<math.h>
#include <string>
using namespace std;
const int MAX_LEN = 100005;
int main(){
    int n;
    int temp[101];
    for(int i=0;i<101;++i){
        temp[i] = 0;
    }
    scanf("%d",&n);
    int cease[n];
    for(int i=0;i<n;++i){
        cin>>cease[i];
        temp[cease[i]]++;
    }
    int tem;
    cin>>tem;
    int te[tem];
    for(int i =0;i<tem;++i){
        cin>>te[i];
    }
    for(int i=0;i<tem;++i){
        int result = te[i];
        if(i ==0){
            cout<<temp[result];
        }else{
            cout<<" "<<temp[result];
        }
    }
    system("pause");
    return 0;
} 

算法初步——哈希表B.1038统计同成绩学生

标签:color   names   哈希表   math   alt   scan   span   lse   初步   

原文地址:https://www.cnblogs.com/JasonPeng1/p/12155910.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!