题干:

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 MM 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.

Input

Multiple test cases, process till end of the input. 
  For each case, the first line contains a positive integers MM, which is the number of groups. 
  The ii-th of the next MM lines begins with a positive integer BiBi representing the number of teams in the ii-th group, followed by BiBi nonnegative integers representing the score of each team in this group. 
number of test cases <= 10
M<= 100
B[i]<= 20000
score of each team <= 20000

Output

For each test case, output MM lines. Output ``F" (without quotes) if the scores in the i-th group must be false, output ``T" (without quotes) otherwise. See samples for detail.

Sample Input

2
3 0 5 1
2 1 1

Sample Output

F
T

题目大意:

每组样例占一行,先给定一个数n,紧接着有n个数。

有n支足球队,每两支队伍都要比一场,赢了得2分,输了得0分,平局双方各得1分。给定n个球队的得分情况,问是否合法。

解题报告:

首先来说明一下兰道定理

兰道定理又称竞赛图定理,是一个定义在有向图上的概念,顾名思义,它可以想象成n个人两两对决,赢得向输的连边,其实就是给一副完全图的无向边定了方向。

定义一个竞赛图的比分序列(score sequence),是把竞赛图的每一个点的出度从小到大排列得到的序列。

一个长度为n的序列

是合法的比分序列当且仅当:且k==n的时候必须取等。

但是兰道定理是赢的一方得一分,输的一方不得分,似乎跟这道题不是很符合,但是你把它改为赢的一方得两分,输的一方不得分,平局各得一分,只需要把公式后面给C(2,K)乘2就好了。

AC代码:代码来自

#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 20010;
int a[MAXN];
int main() {int t;while(scanf("%d",&t) != EOF) {while(t--) {memset(a,0,sizeof(a));int n,i,sum = 0;bool flag = true;scanf("%d",&n);for(int i = 0; i < n; i++) {scanf("%d",&a[i]);sum += a[i];}if(sum != n*(n-1)) {flag = false;puts("F");continue;}sort(a,a+n);sum = 0;for(int i = 0; i < n-1; i++) {sum += a[i];if(sum >= (i + 1) * i) continue;else {flag = false;puts("F");break;}}if(flag) puts("T");}}return 0;
}

【HDU - 5873】Football Games(兰道定理,知识点总结)相关推荐

  1. hdu 5873 Football Games 模拟、兰道定理Landau's Theorem

    hdu 5873 Football Games 题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5873 题目描述: Football Gam ...

  2. HDU 5873 Football Games(竞赛图兰道定理)

    http://acm.hdu.edu.cn/showproblem.php?pid=5873 题意: 现在有比赛,所有队伍两两进行比赛,赢的积2分,输的积0分,如果平局的话就各自都积1分,现在给出每只 ...

  3. Hdu 5873 2016 ACM/ICPC Asia Regional Dalian Online 1006(兰道定理)

    题解: 如果没有平手选项, 赢得加一分的话, 可以用Landau's Theorem(兰道定理)判定. 稍微修改一下这个定理就能做了. 假设S1,S2--,Sn是他们的得分序列,从小到大排个序.那么这 ...

  4. 兰道定理 HDU-5873

    这个题网上的大多数题解都说是思维题 其实可以用兰道定理解决 首先来说明一下兰道定理 兰道定理又称竞赛图定理,是一个定义在有向图上的概念,顾名思义,它可以想象成n个人两两对决,赢得向输的连边,其实就是给 ...

  5. [竞赛图判定定理]兰道定理(Landau's Theorem)介绍及其一种证明

    前言 竞赛图(tournament)是一个定义在有向图上的概念,顾名思义,它可以想象成nn个人两两对决,赢得向输的连边,其实就是给一副完全图的无向边定了方向. 竞赛图有很多十分优美的性质,比如说在之前 ...

  6. [HDU5873] [2016亚洲区域赛大连网络赛] Football Games [构造][兰道定理]

    Link HDU - http://acm.hdu.edu.cn/showproblem.php?pid=5873 Description 有 mmm 个组,每一组有 nnn 支队伍. 每一组队伍中, ...

  7. 【小组专题四点五:素数】素数的分布,素数定理,素数猜想与兰道问题

    3.2 素数的分布与猜想 π(x)\pi(x)π(x) 的近似估计函数 1798年,法国数学家勒让德通过 JurijVegaJurij\;\;VegaJurijVega 计算到400031的素数表 得 ...

  8. css就近原则_细品100道CSS知识点(上)「干货满满」

    作者:hh_phoebe 转发链接:https://juejin.im/post/5ee0cf335188254ec9505381 目录 细品100道CSS知识点(上)[干货满满]本篇 细品100道C ...

  9. P5535 【XR-3】小道消息(伯特兰-切比雪夫定理)

    题意: 有 n 个人,其中第 i 个人的衣服上有一个数 i+1.小 X 发现了一个规律:当一个衣服上的数为 i 的人在某一天知道了一条信息,他会在第二天把这条信息告诉衣服上的数为 j 的人,其中 gc ...

最新文章

  1. 写一个 iOS 复杂表单的正确姿势
  2. 软件开发环境-按模型及方法分类
  3. ios学习笔记-数据持久化
  4. java 判断是否是list_给Java程序员的20个链表面试题
  5. 高级工程考试通过总结
  6. 【IT笔试面试题整理】连续子数组的最大和
  7. 第十二届蓝桥杯省赛A组试题:左儿子右兄弟Java
  8. 算法与数据结构基础 - 堆(Heap)和优先级队列(Priority Queue)
  9. Linux vi vim 常用快捷键操作(一)
  10. override和overload
  11. 8考勤填报_公司考勤管理制度
  12. iOS开发常用三方库、插件、知名博客等等
  13. AutoPatchnbsp;warning:zfaprod.txtnbsp;do…
  14. 共模信号和差模信号的区别和抑制
  15. 微型计算机硬件调研报告,计算机软硬件的产品调查报告分析.doc
  16. GoogleAdMob广告 SDK接入(Android)
  17. 系统监控的四个黄金指标
  18. Python BDD 框架之lettuce
  19. VPS服务器主要用来做什么?
  20. 分数加减法 java,Java——分数加减法

热门文章

  1. iOS vs. Android,应用设计该如何对症下药?
  2. 分享21个丰富多彩的 HTML5 小游戏
  3. android 从assets和res中读取文件(转)
  4. 悬浮窗_华为手机悬浮窗设置在哪里
  5. 从java到C++入门
  6. java服务注册中心有哪些_Spring Cloud服务注册中心简述
  7. 十天学会PHP(第五版),十天学会php之第五天
  8. eclipse 创建 maven web 项目教程
  9. python opencv输出mp4_Python玩转视频处理(四):视频按场景进行分割
  10. CMake 手册详解(二十二)