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.

 
Input
Multiple test cases, process till end of the
input.
  
  For each case, the first line contains a positive integers
M

, which is the number of groups.
  The i

-th of the next M

lines begins with a positive integer Bi

representing the number of teams in the i

-th group, followed by Bi

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 M

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
 
 
 

题意:

m个小组,每个小组n支队伍进行比赛,任意两支队伍之间有一场比赛

一场比赛里赢得+2分输的+0分,打平的话每队+1

先给出每支队伍的得分,判断这些得分是否满足小组比赛的条件

思路:根据这个比赛规则,我们可以发现,每场比赛都有2个积分会出去。

那么问题就很好解决了,先要给那些

得分从小到大排序,对于当前i,与之前的i-1支队伍比赛完之后,所有的比赛的总得分至少是(i-1)*i(因为这i只队伍还要和第i+1~n的队伍打比赛,也可能获得分数

#include<bits/stdc++.h>
using namespace std;
const int maxn = +;
int n,a[maxn];
int main()
{
int T;
while(scanf("%d",&T)!=EOF)
{
while(T--)
{
int res = ;
scanf("%d",&n);
for(int i = ;i<=n;i++)
scanf("%d",&a[i]),res+=a[i];
sort(a+,a++n);
int sum = ;
int flag = ;
for(int i = ;i<=n;i++)
{
sum+=a[i];
if(sum<i*(i-))
{
flag=;
break;
}
}
if(res!=n*(n-))
flag=;
if(flag)
printf("F\n");
else
printf("T\n");
}
}
}

);

最后只要算出比赛的场次*2==总分就可以。

一共有n组,那么任意两只队伍要比赛的话排列组合共有Cn^2种情况,即n*(n-1)/2;

Football Games(思维题)的更多相关文章

  1. [CF1244C] The Football Season【数学,思维题,枚举】

    Online Judge:Luogu,Codeforces Round #592 (Div. 2) C Label:数学,思维题, 枚举 题目描述 某球队一共打了\(n\)场比赛,总得分为\(p\), ...

  2. Codeforces Round #281 (Div. 2) A. Vasya and Football 暴力水题

    A. Vasya and Football time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  3. 16年大连网络赛 1006 Football Games

    题目链接:http://acm.hdu.edu.cn/contests/contest_showproblem.php?cid=725&pid=1006 Football Games Time ...

  4. HDU5873:Football Games

    题目链接: Football Games 分析: 先将分数排序,然后 设当前队编号为p,设个指针为p+1,然后p>1,每次p-=2,指针右移一位p==1,指针指向的队-=1p==0,从指针开始到 ...

  5. zoj 3778 Talented Chef(思维题)

    题目 题意:一个人可以在一分钟同时进行m道菜的一个步骤,共有n道菜,每道菜各有xi个步骤,求做完的最短时间. 思路:一道很水的思维题, 根本不需要去 考虑模拟过程 以及先做那道菜(比赛的时候就是这么考 ...

  6. cf A. Inna and Pink Pony(思维题)

    题目:http://codeforces.com/contest/374/problem/A 题意:求到达边界的最小步数.. 刚开始以为是 bfs,不过数据10^6太大了,肯定不是... 一个思维题, ...

  7. HDU 5873 Football Games 【模拟】 (2016 ACM/ICPC Asia Regional Dalian Online)

    Football Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)To ...

  8. ZOJ 3829 贪心 思维题

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3829 现场做这道题的时候,感觉是思维题.自己智商不够.不敢搞,想着队友智商 ...

  9. 2016大连网络赛 Football Games

    Football Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) P ...

随机推荐

  1. 【模板】概率dp

    有n个投资事件,和一个成功概率最低接受值rate.每个投资的价值是c[i],成功概率是p[i](浮点数). 在保证成功概率≥rate的情况下,使价值最大化. #include<bits/stdc ...

  2. eventlet详解

    正真工作才发现很懒,没这么多时间写文,毕竟小白,参照大神写的,不喜勿喷 1.eventlet是什么eventlet - 具有WSGI支持的异步框架eventlet是python库函数,一个是处理和网络 ...

  3. CVE-2018-1111漏洞复现-环境搭建与dhcp命令注入

    0×01 前言 2018年5月,在Red Hat Enterprise Linux多个版本的DHCP客户端软件包所包含的NetworkManager集成脚本中发现了命令注入漏洞(CVE-2018-11 ...

  4. 利用html2canvas将当前网页保存为图片.

    先分析下这个技术可实现的方式,以及优缺点吧! 前端实现 缺点是:兼容性查,需要高级浏览器支持,因为需要支持 canvas 绘图,还有就是会操作 html5 canvas api.(如果不会使用canv ...

  5. mybatis报错:查询一对多或多对多时只返回一条数据的问题

    问题: 使用映射文件实现查询一对多或多对多时只返回一条数据问题 解决方法: 导致这种情况出现的问题是因为两个表中的主键是一样所以出现了数据覆盖问题. 解决方式一:修改数据库表中的主键(这种方法比较麻烦 ...

  6. Spring笔记2

    Bean生命周期 1 实例化 2 注入属性 3 BeanNameAware 4 BeanFactoryAware 5 ApplicationContextAware 6 BeanPostProcess ...

  7. 微信小程序中无刷新修改

    1.点击事件无刷新修改 原理:onload事件中是把这个分类和品牌的列表全部拿出来,拼接成数组的格式,在小程序中遍历的时候就要把小标(index)给绑定到左侧的品牌上,然后js中获取index的值,就 ...

  8. Trie(字典树,前缀树)_模板

    Trie Trie,又经常叫前缀树,字典树等等. Trie,又称前缀树或字典树,用于保存关联数组,其中的键通常是字符串.与二叉查找树不同,键不是直接保存在节点中,而是由节点在树中的位置决定.一个节点的 ...

  9. 使用Jcrop-canvas画布-制作前端图像裁剪

    写在前面 –公司有这个需求,安排调查 –目前各大网站都是采用的-前端做裁剪返回坐标-由后端来做到裁剪 –而使用html-canvas画布可以直接前端裁剪并返回base64流-ajax可以直接下载保存 ...

  10. JavaSE库存管理系统项目实战

    需求分析 企业库房用于存放成品.半成品.原材料.工具等物资,一般情况下,这些物资统称为物料.库存管理常见业务包括物资的入库.出库.盘点.退货.报废以及财务核算等,业务逻辑比较复杂,库房信息系统项目开发 ...