#include<iostream>
#include<stdio.h>
using namespace std;
#define MAX 110
class Point
{
public:
char brand[MAX];
float price;
float volume;
float money;
};
Point milk[MAX];
int compare(const void *a,const void *b)
{
Point *x=(Point*)a;
Point *y=(Point*)b;
if(x->money==y->money)
{
return y->volume-x->volume;
}
else
{
return x->money-y->money;
}
}
int T;
int N;
int main()
{
//freopen("in.txt","r",stdin);
scanf("%d",&T);
while(T--)
{
scanf("%d",&N);
int i;
for(i=0;i<N;i++)
{
scanf("%s %f %f",milk[i].brand,&milk[i].price,&milk[i].volume);
}
//开始处理
for(i=0;i<N;i++)
{
if(milk[i].volume>=1200)
{
milk[i].money=milk[i].price/5;
}
else if(milk[i].volume<200)
{
milk[i].money=100000000;
}
else
{
int day=milk[i].volume/200;
milk[i].money=milk[i].price/day;
}
}
qsort(milk,N,sizeof(Point),compare);
printf("%s\n",milk[0].brand);
}
return 0;
}
hdoj 1070
最新推荐文章于 2017-03-30 15:37:48 发布