misschuer

常用链接

统计

积分与排名

百事通

最新评论

hdu 1070 Milk

#include <iostream>
#include 
<algorithm>
#define MAXN 111
#include 
<string>
using namespace std;

typedef 
struct {

    
string name;
    
int RMB;
    
int day;
    
int vol;
}Point;

bool GY(Point a, Point b) {

    
if(a.day * b.RMB == a.RMB * b.day) {
    
        
if(a.RMB != b.RMB)
            
return a.RMB < b.RMB;
        
else 
            
return a.vol > b.vol;
    }
 
    
return a.day * b.RMB > a.RMB * b.day;
}

Point p[MAXN];
int n;

int main() {

    
int test, i;
    
string str;
    
int r, d, m;
    cin 
>> test;

    
while(test --) {
    
        scanf(
"%d"&n);
        
        m 
= 0;
        
for(i = 1; i <= n; ++ i) {
        
            cin 
>> str >> r >> d;
            
if(d > 199) {
            
                
++ m;
                p[ m ].name 
= str;
                p[ m ].RMB 
= r;
                p[ m ].vol 
= d;
                
if(d >= 1200) d = 1199;
                p[ m ].day 
= d / 200;
                
            }
            
        }

        sort(p 
+ 1, p + m + 1, GY);
        
        cout 
<< p[ 1 ].name << endl;

    }
    
return 0;
}

posted on 2011-03-13 10:11 此最相思 阅读(174) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理