1. 程式人生 > >題目1018:統計同成績學生人數(數組或者map)

題目1018:統計同成績學生人數(數組或者map)

result ble tdi core %d github col targe 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)