hdu 1070 Milk

来源:互联网 发布:淘宝主店铺子店铺 编辑:程序博客网 时间:2024/05/20 03:07
#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>#include <vector>#include <queue>#include <set>#include <map>#include <string>#include <math.h>#include <stdlib.h>#include <time.h>using namespace std;int main(){    int _,i,n,p1,v1,p,v,t1,t;    double k1,k;    char ans[1024],s[1024];    scanf("%d",&_);    while(_--)    {        scanf("%d",&n);        v1=0;        k1=9999999;        for(i=0;i<n;i++)        {            scanf("%s%d%d",s,&p,&v);            if(v<200) continue;            if(v>=1000) t=5;            else t=v/200;            k=1.0*p/t;            if(k<k1||(k==k1&&v>=v1))            {                v1=v;                k1=k;                strcpy(ans,s);            }        }        printf("%s\n",ans);    }    return 0;}
0 0
原创粉丝点击