GYM 100712 A.Who Is The Winner?(水~)

253 篇文章 2 订阅

Description
给出n支参赛队伍的名称,过题数和罚时,过题数多者优,相同过题数罚时少者优,问冠军是谁
Input
第一行一整数T表示用例组数,每组用例首先输入一整数n表示队伍数,之后n行每行输入一支队伍的名称,过题数s和罚时p(1<=T<=128,1<=n<=100,名称长度不超过20,0<=s<=16,0<=p<=1500)
Output
输出冠军
Sample Input
2
3
tourist 13 567
petr 13 600
endagorion 14 419
2
tourist7512
bayashout 7477
Sample Output
endagorion
bayashout
Solution
简单题,排个序即可
Code

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
#define maxn 111
struct node
{
	char c[22];
	int s,p;
	bool operator <(const node&b)const
	{
		if(s!=b.s)return s>b.s;
		return p<b.p;
	}
}a[maxn];
int T,n;
int main()
{
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d",&n);
		for(int i=0;i<n;i++)scanf("%s%d%d",a[i].c,&a[i].s,&a[i].p);
		sort(a,a+n);
		printf("%s\n",a[0].c);
	}
	return 0;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值