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. ios appstore 上架应用被拒绝原因

    ios appstore 上架应用被拒绝原因 应用程序崩溃 界面布局有明显错误挂羊头卖狗头的应用包括未公开的或隐藏功能的使用私有API应用程序读取或写入数据超出其指定的容器区域以任何方式下载代码的应用 ...

  2. Sass 基础(六)

    join() 函数 join()函数是将两个列表连接合并成一个列表. >>join(10px 20px, 30px 40px) (10px 20px 20px 40px) >> ...

  3. 原生js方面的兼容性问题

    1.关于获取行外样式 currentStyle 和 getComputedStyle 出现的兼容性问题  我们都知道js通过style不可以获取行外样式,当我们需要获取行外样式时:  我们一般通过这两 ...

  4. ETO的公开赛T4《对抗水滴》 题解(BY 萌萌哒123456 )

    题意: 给你一个\(n*n\)的矩阵A,其中有\(T\)个元素不为零.定义矩阵内元素\((x,y)\)的能量值 \(E[x][y]=\sum_{i=1}^{x}\sum_{j=1}^{y}[A[i][ ...

  5. 【2018 ICPC焦作网络赛 G】Give Candies(费马小定理+快速幂取模)

    There are N children in kindergarten. Miss Li bought them N candies. To make the process more intere ...

  6. jsonp跨域请求360数据乱码解决办法

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8&quo ...

  7. python实现简单决策树(信息增益)——基于周志华的西瓜书数据

    数据集如下: 色泽 根蒂 敲声 纹理 脐部 触感 好瓜 青绿 蜷缩 浊响 清晰 凹陷 硬滑 是 乌黑 蜷缩 沉闷 清晰 凹陷 硬滑 是 乌黑 蜷缩 浊响 清晰 凹陷 硬滑 是 青绿 蜷缩 沉闷 清晰 ...

  8. 分享一个PC端六格密码输入框写法

    如图.我们一般做商城类的项目不免会用到支付密码输入框,我研究了下并决定发上来,也当作是自己成长路上的一点小小的记录.本次介绍的是基于vue的项目 html: <template> < ...

  9. Asp.NET Core 在IIS部署 An assembly specified in the application dependencies manifest was not found

    今天在发布应用的时候,出来了一个报错:An assembly specified in the application dependencies manifest was not found 情况如下 ...

  10. git克隆出错 github clone Permission denied (publickey) fatal Could not read from remote repo

    原文网址:http://blog.csdn.net/feeling450/article/details/53067563 github clone "Permission denied ( ...