首页 > 编程语言 > 详细

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

时间:2017-05-15 23:30:30      阅读:366      评论:0      收藏:0      [点我收藏+]

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

原文:http://www.cnblogs.com/zpfbuaa/p/6858911.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!