您的位置:首页 > 其它

题目1018:统计同成绩学生人数(数组或者map)

2017-05-15 22:54 555 查看
题目链接:http://ac.jobdu.com/problem.php?pid=1018

详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus

参考代码:

//
//  1018.cpp
//  oj
//
//  Created by PengFei_Zheng on 05/04/2017.
//  Copyright © 2017 PengFei_Zheng. All rights reserved.
//
//ios::sync_with_stdio(false);

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>

using namespace std;

int n,temp,grade;
int score[101]={0};

int main(){

while(scanf("%d",&n)&&n!=0){
memset(score,0,sizeof(score));
for(int i = 0 ; i < n ; i++){
scanf("%d",&temp);
score[temp]++;
}
scanf("%d",&grade);
printf("%d\n",score[grade]) ;
}
}

/**************************************************************
Problem: 1018
User: zpfbuaa
Language: C++
Result: Accepted
Time:10 ms
Memory:1520 kb
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: