Codeforces Round #2A Winner
来源:互联网 发布:淘宝店铺动态 编辑:程序博客网 时间:2024/04/28 21:16
#include <iostream>#include <map>#include <string>using namespace std;const int maxn = 1005;int score[maxn];string name[maxn];int main(){int n;while (cin >> n) {map<string, int> m;for (int i = 0; i < n; ++i) {cin >> name[i] >> score[i];m[name[i]] += score[i];score[i] = m[name[i]];}map<string, int>::iterator it;int maxscore = -1e9;for (it = m.begin(); it != m.end(); ++it) {if ((*it).second > maxscore) maxscore = (*it).second;}int pos = 0;for (int i = 0; i < n; ++i) {if (m[name[i]] == maxscore && score[i] >= maxscore) {pos = i;break;}}cout << name[pos] << endl;}return 0;}
0 0
- Codeforces Round #2A Winner
- Codeforces Beta Round #2 A. Winner
- Codeforces Beta Round #2 A. Winner
- codeforces 2A Winner
- CODEFORCES 2A-Winner
- codeforces 2A. Winner
- Codeforces 2A Winner
- codeforces 2A Winner
- codeforces 2-A Winner
- codeforces 2A.Winner
- Codeforces 2A. Winner
- Codeforces 2A :winner
- CodeForces 2A-Winner
- 【codeforces#2A】Winner
- CodeForces#2A Winner
- CodeForces 2A. Winner
- Codeforces #2 A Winner
- Codeforces 2 A. Winner
- OpenGLES demo - 12. 材质贴图 Texture Mapping
- 《深入理解mybatis原理》 MyBatis事务管理机制
- poj 1789 Truck History (最小生成树)
- Python读写文件
- 定制自己的FancyBox
- Codeforces Round #2A Winner
- 海归进入贬值时代?
- tiny210(s5pv210)移植u-boot(基于 2014.4 版本)——移植u-boot-spl.bin(核心初始化)
- UVA11258- String Partition
- 队列中取最大值操作
- JSP常见的三个编译指令
- 9.1 触摸和手势:触摸的基本概念
- 注册时提示用户名小于3或者密码不匹配问题的临时办法
- MySQL-使用游标循环中断的问题