/*********************************
* 日期:2011-3-11
* 作者:SJF
* 题号:杭电1070
* 题目:Milk
* 结果:AC
* 题意:
* 总结:
**********************************/
#include<stdio.h>
#include<string.h>
typedef struct
{
char Brand[101];
int price,volume,day;
double ratio;
}Milk;
Milk milk[101];
int main()
{
int N,kind,i;
while(scanf("%d",&N)!=EOF)
{
while(N--)
{
double cheapest=999999;
int mark;
scanf("%d",&kind);
for(i=0;i<kind;i++)
{
scanf("%s",&milk[i].Brand);
scanf("%d %d",&milk[i].price,&milk[i].volume);//printf("%s %d %d\n",milk[i].Brand,milk[i].price,milk[i].volume);
milk[i].day=milk[i].volume/200;
if(milk[i].day>5)
{
milk[i].day=5;
}
else if(milk[i].day==0)
{
continue;
}
milk[i].ratio=(double)milk[i].price/milk[i].day;
if(cheapest>milk[i].ratio)
{
cheapest=milk[i].ratio;
mark=i;
}
else if(cheapest==milk[i].ratio)
{
if(milk[mark].volume<milk[i].volume)
{
mark=i;
}
}
}
printf("%s\n",milk[mark].Brand);
}
}
return 0;
}
杭电1070 Milk
最新推荐文章于 2021-08-20 19:37:13 发布