Quality and CCPC

English foundation:

the fractional part  小数部分
disclaimer      免责声明
fictitious       虚构的,编造的;假定的,虚设的;小说式的;假装的
No two teams have the same name.
round down the number  下取整
proportion       比例,占比;部分;面积;均衡
rounded to the nearest integer  四舍五入到最近的整数
Rounding means to make a number shorter or simpler, but keeping it as close in value as possible to the original number. 
A team ranks before another if they solved more problems or both teams solved an equal number of problems but they had less penalty time.

 

题目:http://acm.hdu.edu.cn/contests/contest_showproblem.php?pid=1010&cid=855

分析:

 

代码:

 

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;

struct team
{
    char s[15];
    int p,t;
}te[100005];

bool cmp(team x,team y)
{
    if(x.p==y.p) return x.t<y.t;
    else 	     return x.p>y.p;
}

int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int num,d;
        scanf("%d%d",&num,&d);
        for(int i=0;i<num;i++)
        {
            scanf("%s",te[i].s);
            scanf("%d%d",&te[i].p,&te[i].t);
        }
        if(num*d%10!=5)
		{
            puts("Quailty is very great");
            continue;
        }
        else
		{
            sort(te,te+num,cmp);
            int x=ceil(num*0.1*d)-1;
            printf("%s\n",te[x].s);
        }
    } 
} 

 

  

 

 
 

 

posted @ 2019-08-15 15:06  龙龙666666  阅读(273)  评论(0编辑  收藏  举报