Football Games

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 514    Accepted Submission(s): 188

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
 
签到水题,只需要判断两个条件:
1.分数之和==2×C(2,n),因为只要比一场赛,无论结果,双方总得分和为2。
2.分数最高的不会超过2×(n-1)分,即假设他与其他n-1支队伍踢都赢,最多只能有2×(n-1)分
 //2016.9.11
#include <iostream>
#include <cstdio>
#define N 20005 using namespace std; int b[N]; int C(int m, int n)
{
if(n-m < m)m = n-m;
int ans = ;
for(int i = ; i < m; i++)
{
ans *= n;
n--;
}
for(int i = ; i <= m; i++)
ans /= i;
return ans;
} int main()
{
int m, n;
while(scanf("%d", &m)!=EOF)
{
while(m--)
{
scanf("%d", &n);
int sum = , max = ;
for(int i = ; i < n; i++)
{
scanf("%d", &b[i]);
sum += b[i];
if(max<b[i])max = b[i];
}
int c = C(, n);
if(sum==*c && max<=*(n-))
printf("T\n");
else printf("F\n");
}
} return ;
}

HDU5873的更多相关文章

  1. HDU5873:Football Games

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

随机推荐

  1. Fourinone 作者博客 -集群复制

    http://my.oschina.net/fourinone/blog http://www.iteye.com/blogs/subjects/fourinone http://fourinone. ...

  2. 路过Haxe

    刚才在看Nape的时候,看到Haxe的代码,意外的感觉到亲切. 因为之前写过as2代码,最近学习了python,所以对haxe看起来很亲切,于是路过一下写了个HelloWorld. 另外,估计很长时间 ...

  3. VS2010 中 error 2732: 链接规范与的早期规范冲突 的解决

    在实验室做项目的时候遇到了这个问题,终于整明白了. 一般来说这个错误出现在类似以下的语句中 extern "C" int yylex(void); extern "C&q ...

  4. iOS开发——An App ID with identifier "*****" is not avaliable

    Error: An App ID with identifier "*****" is not avaliable. Please enter a different string ...

  5. iOS调用相机,相册,上传头像

    一.新建工程 二.拖控件,创建映射 三.在.h中加入delegate @interface ViewController : UIViewController 复制代码 四.实现按钮事件 -(IBAc ...

  6. Nginx 在configure时的参数

    Nginx 使用 Unix 下常用的 './configure && make && make install' 过程来编译安装. configure 脚本确定系统所具 ...

  7. Android和BLE模块连接通信

    首先,进行一下科普: 1.BLE(Bluetooth Low Energy),蓝牙4.0核心profile,主要特点是快速搜索,快速连接,超低功耗保持连接和数据传输,缺点:数据传输速率低,由于其具有低 ...

  8. Java Dwr3实现消息推送步骤详解

    DWR包含两个主要的部分:允许JavaScript从WEB服务器上一个遵循了AJAX原则的Servlet中获取数据.另外一方面一个JavaScript库可以帮助网站开发人员轻松地利用获取的数据来动态改 ...

  9. Delphi 与 DirectX

    关于DirectX 在Delphi下的使用 源:Delphi 与 DirectX

  10. Tsinsen-1486:树【Trie树 + 点分治】

    暴力部分: 这个题一开始的想法是 n^2 枚举两个点,然后logn维护LCA,在倍增的同时维护异或值和 k 的个数. s_z_l老爷指导了新的思路,既然这个树只有n^2个LCA,那么枚举LCA,同时向 ...