首页 > 代码库 > 题目1018:统计同成绩学生人数(数组或者map)

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

题目链接: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

 

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