【水】#68 A. Room Leader

A. Room Leader
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Let us remind you part of the rules of Codeforces. The given rules slightly simplified, use the problem statement as a formal document.

In the beginning of the round the contestants are divided into rooms. Each room contains exactly n participants. During the contest the participants are suggested to solve five problems, ABCD and E. For each of these problem, depending on when the given problem was solved and whether it was solved at all, the participants receive some points. Besides, a contestant can perform hacks on other contestants. For each successful hack a contestant earns 100 points, for each unsuccessful hack a contestant loses 50points. The number of points for every contestant is represented by the sum of points he has received from all his problems, including hacks.

You are suggested to determine the leader for some room; the leader is a participant who has maximum points.

Input

The first line contains an integer n, which is the number of contestants in the room (1 ≤ n ≤ 50). The next n lines contain the participants of a given room. The i-th line has the format of "handlei plusi minusi ai bi ci di ei" — it is the handle of a contestant, the number of successful hacks, the number of unsuccessful hacks and the number of points he has received from problems AB,CDE correspondingly. The handle of each participant consists of Latin letters, digits and underscores and has the length from 1to 20 characters. There are the following limitations imposed upon the numbers:

  • 0 ≤ plusi, minusi ≤ 50;
  • 150 ≤ ai ≤ 500 or ai = 0, if problem A is not solved;
  • 300 ≤ bi ≤ 1000 or bi = 0, if problem B is not solved;
  • 450 ≤ ci ≤ 1500 or ci = 0, if problem C is not solved;
  • 600 ≤ di ≤ 2000 or di = 0, if problem D is not solved;
  • 750 ≤ ei ≤ 2500 or ei = 0, if problem E is not solved.

All the numbers are integer. All the participants have different handles. It is guaranteed that there is exactly one leader in the room (i.e. there are no two participants with the maximal number of points).

Output

Print on the single line the handle of the room leader.

Sample test(s)
input
5
Petr 3 1 490 920 1000 1200 0
tourist 2 0 490 950 1100 1400 0
Egor 7 0 480 900 950 0 1000
c00lH4x0R 0 10 150 0 0 0 0
some_participant 2 1 450 720 900 0 0
output
tourist
Note

The number of points that each participant from the example earns, are as follows:

  • Petr — 3860
  • tourist — 4140
  • Egor — 4030
  • c00lH4x0R —  - 350
  • some_participant — 2220

Thus, the leader of the room is tourist.


这又是一道读入的时候更新最大值类型的问题……真的不知道该划分到哪个类型……直接就写个【水】不好意思哦……

每次读入的时候就把这个人的分数算出来,如果是最大的就把最大值更新一下即可。

Code:

#include <map>
#include <stack>
#include <queue>
#include <cmath> 
#include <cctype>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))

bool cmp(const int a, const int b)
{
	return a > b;
}

int main()
{
	int cases=0;
	scanf("%d",&cases);
	int max=-2999;
	string win="";
	for(int _case=1;_case<=cases;_case++)
	{
		string name; 
		int p,m,a,b,c,d,e,score;
		cin>>name>>p>>m>>a>>b>>c>>d>>e;
		score=p*100-m*50+a+b+c+d+e;
		if (score>max) max=score,win=name;
	}
	cout<<win;
	return 0;
}




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

糖果天王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值