Hdu 5873 Football Games
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hdu 5873 Football Games相关的知识,希望对你有一定的参考价值。
Problem Description
A mysterious country will hold a football world championships---Abnormal Cup, attracting football teams and fans from all around the world. This country is so mysterious that none of the information of the games will be open to the public till the end of all the matches. And finally only the score of each team will be announced. At the first phase of the championships, teams are divided into M groups using the single round robin rule where one and only one game will be played between each pair of teams within each group. The winner of a game scores 2 points, the loser scores 0, when the game is tied both score 1 point. The schedule of these games are unknown, only the scores of each team in each group are available. When those games finished, some insider revealed that there were some false scores in some groups. This has aroused great concern among the pubic, so the the Association of Credit Management (ACM) asks you to judge which groups‘ scores must be false.
题意:给出 N 个队伍两两互决得出的比分(赢得2分,平得1分,输没有分),判断得分是否合理。
模拟题,按得分从大到小排序,假设大全赢,不够的得分靠后面的来补充。
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; int num[1000000],tmp[1000000]; int main(){ int T,n; while(scanf("%d",&T)!=EOF){ while(T--){ scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&num[i]); sort(num+1,num+1+n); bool pan=true; int sum=0; for(int i=1;i<=n;i++) sum+=num[i]; if(sum!=(n-1)*n) pan=false; int delta=2*(n-1)-num[n]; if(delta<0) pan=false; num[n]=0; for(int i=n-1;i>=1;i--){ num[i]-=delta; delta=2*(i-1)-num[i]; if(delta<0) pan=false; num[i]=0; } if(delta!=0) pan=false; if(pan) puts("T"); if(!pan)puts("F"); } } return 0; }
吐槽下数据,好多人都是判断<=(n-1)*2 以及总分就A了
以上是关于Hdu 5873 Football Games的主要内容,如果未能解决你的问题,请参考以下文章
HDU 5873 Football Games(竞赛图兰道定理)
HDU 5873 Football Games 模拟 (2016 ACM/ICPC Asia Regional Dalian Online)
2016 ACM/ICPC Asia Regional Dalian Online 1006 Football Games