hdu1070
#include <stdio.h>
#include <string.h>
struct milk{
char brand[128];
int price;
int volume;
double value;
}a[100];
int main(void){
int i,t,n,d;
struct milk tmp;
scanf("%d",&t);
while (t--){
scanf("%d",&n);
for (i=0; i<n; i++){
scanf("%s %d %d",a[i].brand,&a[i].price,&a[i].volume);
d = a[i].volume/200;
if (d==0)
a[i].value = 3.4e+38; // 小于200毫升则费用最高
else if (d<=5)
a[i].value = (double)a[i].price/d;
else
a[i].value = (double)a[i].price/5;
}
tmp = a[0];
for (i=1; i<n; i++)
if (a[i].value<tmp.value)
tmp = a[i];
else if (a[i].value==tmp.value && a[i].volume>tmp.volume)
tmp = a[i];
printf("%s\n",tmp.brand);
}
return 0;
}
最新文章
- url参数中带有+号,服务器端解码之后没了
- 转载--PayPal高级工程总监:读完这100篇论文 就能成大数据高手
- linux下搭建nagios
- JAVA-封装
- 一步一步学习Swift之(四)玩转UIWebView
- Inno Setup设置NT服务
- zedboard如何从PL端控制DDR读写(二)——AXI总线
- http header详解
- jQuery之渐变切换
- json解析之jackson ObjectMapper
- C++类型转换运算符
- String类中几个简单的常用方法
- Swift - 使用UIWebView和UIToolbar制作一个浏览器
- 201521123093 java 第二周学习总结
- python入门之函数
- Matplotlib学习---用seaborn画联合分布图(joint plot)
- 硬盘SMART检测参数详解[转]
- 如何开始学习ADF和Jdeveroper 11g
- Lucene创建索引流程
- 自学Zabbix3.12.4-动作Action-Operation配置