胜利者

描述:

The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only one player with the maximum number of points, he is the winner. The situation becomes more difficult if the number of such players is more than one. During each round a player gains or loses a particular number of points. In the course of the game the number of points is registered in the line "name score", where name is a player's name, and score is the number of points gained in this round, which is an integer number. If score is negative, this means that the player has lost in the round. So, if two or more players have the maximum number of points (say, it equals to m) at the end of the game, than wins the one of them who scored at least m points first. Initially each player has 0 points. It's guaranteed that at the end of the game at least one player has a positive number of points.

Berland流行的纸牌游戏“Berlogging”的胜利者根据一下规则规定。如果在游戏的最后只有一个玩家有最大的点数,他就是最后赢家。如果玩家超过一个人,情况会变得更难。每个回合玩家获得或失去一个特定的积分。在游戏过程中,点数记录在“名字得分”中,名字是指玩家的姓名。如果分数为负数,这意味着玩家在这回合中输了。所以,如果有两个玩家或者更多在游戏结束有最高得分(假设为m),最后赢家就是最早获得最高分的人。初始时,每个玩家都只有0分。这保证在游戏结束至少有一个人的分数为正数。

输入:

The first line contains an integer number n (1  ≤  n  ≤  1000), n is the number of rounds played. Then follow n lines, containing the information about the rounds in "name score" format in chronological order, where name is a string of lower-case Latin letters with the length from 1 to 32, and score is an integer number between -1000 and 1000, inclusive.

第一行输入包含一个整数n(1<=n<=1000),n是每一回合玩家的人数。接下来输入n行,按时间顺序包含有关“名称分数”格式的回合信息。其中,名称是1~32位的小写字母,分数是-1000~1000的整数。

输出:

Print the name of the winner.

输出胜利者的姓名。

样例输入:

3
mike 3
andrew 5
mike 2

样例输出:

andrew

样例输入:

3
andrew 3
andrew 2
mike 5

样例输出:

andrew

https://acs.jxnu.edu.cn/problem/CF2Ahttps://acs.jxnu.edu.cn/problem/CF2A

1.20 Winner相关推荐

  1. c语言报数问题程序,转圈报数问题(C语言):有n个人围成一圈,顺序排号……...

    问题描述: 有n个人围成一圈,顺序排号.从第1个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号那位. 题目分析: 这道题目是我们在日常生活中也能经常见到的一种报数小游戏.首 ...

  2. python分析比赛_实战项目练习 ---- 【2018世界杯】用python分析夺冠球队

    2018世界杯 前言 在网上找到了个用Python分析2018世界杯夺冠热门的项目,感觉很有意思准备拿来练练手. 因为目前还没有学到图形可视化部分,所以这部分内容会完全借鉴网上的教程. 分析目的 通过 ...

  3. 转圈报数问题(C语言):有n个人围成一圈,顺序排号……

    问题描述: 有n个人围成一圈,顺序排号.从第1个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号那位. 题目分析: 这道题目是我们在日常生活中也能经常见到的一种报数小游戏.首 ...

  4. 利用php屏蔽海外ip访问,高效实现

    <?php/*** 屏蔽海外ip访问* 使用ip2long函数得到ip转为整数的值,判断值是否在任一一个区间中* 以下是所有国内ip段* 调用方法:IschinaIp($ALLIPS)* 返回值 ...

  5. pat1011. World Cup Betting (20)

    1011. World Cup Betting (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Wit ...

  6. 【leetcode】486. Predict the Winner

    题目如下: Given an array of scores that are non-negative integers. Player 1 picks one of the numbers fro ...

  7. 浙江大学PAT上机题解析之1011. World Cup Betting (20)

    1011. World Cup Betting (20) 时间限制  400 ms 内存限制  32000 kB 代码长度限制  16000 B 判题程序    Standard 作者    CHEN ...

  8. 【PAT (Advanced Level) Practice】1041 Be Unique (20 分)

    1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is desi ...

  9. 【PAT (Advanced Level) Practice】1124 Raffle for Weibo Followers (20 分)

    1124 Raffle for Weibo Followers (20 分) John got a full mark on PAT. He was so happy that he decided ...

最新文章

  1. 十五天精通WCF——第六天 你必须要了解的3种通信模式
  2. VC++实现QQ聊天工具【源代码】
  3. 一款 Java 开源的 Spring Boot 即时通讯 IM 聊天系统
  4. Citrix VDI实战攻略之五:vDisk配置
  5. 科研必备:10款提升科研效率的神器
  6. 将字符串的首字母变为大写
  7. linux使用jinja2模板_SaltStack配置管理工具jinja2模板的使用
  8. ora29280 oracle,细节:utl_file_dir错误设置导致ORA-29280
  9. mysql表缓冲大小可能设置过小_MySQL 5.7 my.cnf配置文件详解
  10. 全面剖析 Knative Eventing 0.6 版本新特性
  11. npm的安装和更新---npm工作笔记002
  12. pcm转换在线工具_律师必备的PDF在线转换工具,推荐5款,全免费!
  13. 【ROS学习笔记】(十二)常用可视化工具
  14. H3C ipv6与ipv4(6to4)隧道实验
  15. 计算机桌面无法中英文切换,输入法无法切换到中文怎么办_输入法失效只能打英文的解决方法...
  16. python爬取京东一款手机的评论
  17. 小程序地图,回到当前所在位置
  18. weblogic fmw_12.2.1.0.0_wls下载及安装教程
  19. 什么是节流(throttling)和防抖(debouncing)?
  20. 数学家对物理学家的鄙视_物理学家的未来经济学

热门文章

  1. 千兆网卡如何才能达到全速
  2. 主从芯片can通信无法进入接收中断
  3. ctyoung显示服务器错误,校园CT-Young问题汇总及处理方法.docx
  4. 剪切的文件怎么恢复?
  5. RJ45网口座子上的LED接法详解
  6. python写安卓游戏辅助软件_GitHub - Jinnrry/RobotHelper: 安卓游戏自动化脚本框架|Automated script for Android games...
  7. 图像分类训练tricks
  8. 有效竞品分析读书笔记
  9. php 商城运费计算,ecshop商城运费计算移植到app
  10. 主成分分析法(PCA)