Score Statistics Time limit:3000/1000ms (java/other) Memory limit:65535/32768k (Java/other) total submission (s): Accepted Su Bmission (s): 19font:times New Roman | Verdana | Georgiafont Size:←→problem Description Double 12 problem processing finished, Ikids seniors again met a
Thorny question now ikids seniors have a lot of people to count them
The total number, need your help, ikids seniors afraid of problems too
Trouble, the kind of people are numbered. Input inputs contain multiple sets of inputs
Enter M, m for m record
Each record contains two integers, each representing the person's number and score
M < 1000
Number, score < 1E9 + 7;output will all recorded people follow the number from small to large way
Output their numbers, fractions. Sample Input
52 33 24 22 12 1
Sample Output
2 53 24 2
Simple usage of Authoraoxuets map
#include <stdio.h>//#include <bits/stdc++.h> #include <string.h> #include <iostream> #include <math.h> #include <sstream> #include <set> #include <queue> #include <map> #include < vector> #include <algorithm> #include <limits.h> #define INF 0x3fffffff#define Lson l,m,rt<<1# Define Rson m+1,r,rt<<1|1#define LL long longusing namespace std;map<string,int>q;struct p{string s; int num;} Hehe[10000];bool cmd (P x,p y) {if (X.S<Y.S) return 1; return 0;} int main () {int t; int i; string S; int num; while (cin>>t) {for (i=0;i<t;i++) {cin>>hehe[i].s>>hehe[i].num; Q[hehe[i].s]+=hehe[i].num; }//Cout<<q.size () <<endl; Map<string,int>::iterator it; For (It=q.begin (); It!=q.end (); it++) {cout<<it->first<< "" <<it->second<<endl; } q.clear (); } return 0;}
Hunan University of Technology Innovation Laboratory 2015 Freshman (i) 1009 (re-opened)