原题链接--Winner | JXNUOJNOJ is yet another Online Judge providing you functions like problem solving, discussing, solutions, groups, contests and ranking system.https://acs.jxnu.edu.cn/problem/CF2A
Winner
1000ms 65536K
描述:
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.
译文: 在伯兰一个受欢迎的卡牌游戏的赢家是由以下规则来确定。如果在最后只有一位玩家拥有最大点数,那么他就是赢家。如果拥有点数最大的玩家不只一个那么情况将会更复杂。每一回合玩家都会得到或失去一个特别的点数。在游戏的过程中点数会记录在“名字得分”上,名字是玩家的名字,得分是在这一回合获得的点数,并且是个整数。如果得分是负的,代表该玩家这一回合失去了点数。如果两个或两个以上的玩家点数最大(该点数等于m),那么赢家将会是第一个获得至少为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