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. 你不知道的javaScript笔记(7)

    异步:现在与将来 分块的程序 可以把JavaScript 程序写在单独的js 文件中,这个程序是由多个块组成的,这些块 中只有一个是现在执行,其余在捡来执行,最常见的块单位是函数. 例如: funct ...

  2. 纯css实现移动端横向滑动列表

    前几天在公司做开发的时候碰到一个列表横向滑动的功能,当时用了iscroll做,结果导致手指触到列表的范围内竖向滑动屏幕滑动不了的问题. 这个问题不知道iscroll本身能不能解决,当时选择了换一种方式 ...

  3. 【TOJ 1449】Area of Circles II(求不同位置的两圆面积之和)

    描述 There are two circles on the plane. Now you must to calculate the area which they cover the plane ...

  4. tomcat端口占用后的解决办法【亲测有效】

    https://www.cnblogs.com/zhangtan/p/5856573.html 检测正在使用的端口   这里就以win7为例进行讲解. 首先打开cmd,打开的方法很简单,在开始菜单中直 ...

  5. oracle 12.1的删除和创建公共用户问题

    版本12.1 ,cdb-rac模式 一个集群,4个节点,一个cdb,下面有12个pdb. os:linux 64 --- 删除用户 drop user c##test atler.log提示 ORA- ...

  6. classList属性详解

    之前我们要操作一个DOM元素的class属性,需要对这个DOM的class进行繁琐的循环判断,而现在HTML5为每个元素定义了classLlist属性,用于在元素中添加,移除及切换 CSS 类.该属性 ...

  7. Python学习:运算符

    简单运算符: +(加) 两个对象相加 -(减) 从一个数中减去另一个数,如果第一个操作数不存在,则假定为零 *(乘) 给出两个数的乘积,或返回字符串重复指定次数后的结果   Eg.'haha' * 3 ...

  8. ThinkPHP中的pathinfo模式和URL重写

    语文一直不太好,要我怎么解释这个pathinfo模式还真不知道怎么说,那就先来一段代码说下pathinfo模式吧 http://serverName/appName/module/action/id/ ...

  9. go学习笔记-结构体

    结构体 结构体是由一系列具有相同类型或不同类型的数据构成的数据集合 定义 格式 type struct_variable_type struct { member definition; member ...

  10. Verilog学习笔记基本语法篇(七)········ 生成块

    生成块可以动态的生成Verilog代码.可以用于对矢量中的多个位进行重复操作.多个模块的实例引用的重复操作.根据参数确定程序中是否包含某段代码.生成语句可以控制变量的声明.任务和函数的调用.还能对实例 ...