水。
代码:
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
struct Node{
char s[105];
int price;
int v;
double perPrice;
}a[105];
bool cmp(Node x,Node y)
{
if(x.perPrice != y.perPrice)
return x.perPrice < y.perPrice;
else if(x.v != y.v)
return x.v > y.v;
}
int main()
{
int _;
scanf("%d",&_);
while(_--)
{
memset(a,0,sizeof(a));
int n;
scanf("%d",&n);
for(int i = 0;i < n;++i)
{
scanf("%s%d%d",a[i].s,&a[i].price,&a[i].v);
if(a[i].v / 200)
{
int t = a[i].v / 200;
if(t > 5)
t = 5;
a[i].perPrice = (double)a[i].price / t;
}
}
sort(a,a + n,cmp);
for(int i = 0;i < n;++i)
{
if(a[i].perPrice)
{
printf("%s\n",a[i].s);
break;
}
}
}
return 0;
}