码迷,mamicode.com
首页 > 其他好文 > 详细

1038 统计同成绩学生

时间:2020-02-19 12:50:27      阅读:73      评论:0      收藏:0      [点我收藏+]

标签:code   htable   scanf   stream   http   div   ash   print   space   

水题。

#include<iostream>
using namespace std;

int hashtable[111]= {0}; //成绩与人数的映射
int main() {
    int n,score,k;
    cin>>n;
    for(int i = 0; i < n; ++i) {
        scanf("%d",&score);
        hashtable[score]++;
    }
    cin>>k;
    for(int i = 0; i < k ; ++i) {
        scanf("%d",&score);
        if(i > 0) printf(" ");
        printf("%d",hashtable[score]);
    }
    return 0;
}

 技术图片

 

1038 统计同成绩学生

标签:code   htable   scanf   stream   http   div   ash   print   space   

原文地址:https://www.cnblogs.com/keep23456/p/12330662.html

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