hdu 1070Milk
地址链接:http://acm.hdu.edu.cn/showproblem.php?pid=1070
题意:多看几遍,学着静下来心去看英文题
代码:
#include<bits/stdc++.h> using namespace std; struct p { char s[200]; int money; int v; int v1; int day; double price; }P[10000]; bool cmp(p X,p Y) { if(X.price==Y.price) return X.v1>Y.v1; return X.price<Y.price; } int main() { int t,n; cin>>t; while(t--) { cin>>n; for(int i=0;i<n;i++) { cin>>P[i].s>>P[i].money>>P[i].v1; P[i].v=P[i].v1; if(P[i].v>=1000) P[i].v=1000; P[i].v=P[i].v/200*200; P[i].day=P[i].v/200; P[i].price=P[i].money*1.0/P[i].day; } sort(P,P+n,cmp); cout<<P[0].s<<endl; } return 0; }
anytime you feel the pain.hey,refrain.don't carry the world upon your shoulders