HDU5873
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
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
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
Sample Input
Sample Output
//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的更多相关文章
- HDU5873:Football Games
题目链接: Football Games 分析: 先将分数排序,然后 设当前队编号为p,设个指针为p+1,然后p>1,每次p-=2,指针右移一位p==1,指针指向的队-=1p==0,从指针开始到 ...
随机推荐
- ILayer
ILayer http://127.0.0.1:47873/help/1-4452/ms.help?method=page&id=ESRICARTO-7E8C676F-000BCF&p ...
- 修改非空表字段类型Oracle
执行以下语句报"要修改数据类型,则要更改的列必须为空" alter table 表名 modify (目标字段 varchar2(100)); 解决步骤: 第一步,在表 ...
- 创建git密钥的时候提示 too many arguments
这个时候只要这样做就ok了, 给邮箱包两层引号,如下: " 'zhangsanfeng@qq.com' " 妥妥的!
- vim 配置快捷以使复制可用
"设置快捷以使用xshell的复制 let g_copy_mode = function! CopyToggle() let g:g_copy_mode = set mouse=c set ...
- Tasks and Back stack 详解
原文地址:http://developer.android.com/guide/components/tasks-and-back-stack.html 一个应用往往包含很多activities.每个 ...
- 基于Keepalvied的Mysql主主漂移(切换)
Keepalived实现原理:Keepalived详细介绍简介 实验环境 Master1.Amoeba--IP:192.168.1.5 Master2---IP:192.168.1.10 同时安装ke ...
- [Unity Shader]光照模型对物体的假设
什么是光照模型 光照模型就是模拟光在物体间的传递过程,以确保物体可见表面每一点的亮度和颜色. 当光照射到一个物体表面时,光可能被吸收.反射或折射.反射和折射的光使物体可见.如果入射光全部被吸收,物体将 ...
- XML&AJAX
AJAX: Asynchronous Javascript and XML 1. 客户端触发异步操作 2. 创建新的XMLHttpRequest, 是重要的js对象,通过它提起对服务器端的请求 3. ...
- OPENCV图像变换-1
图像变换是指将一幅图像变换为图像数据的另一种表现形式,例如将图像进行傅立叶变换,或者对图像进行X,Y方向的求导等,经过这些变换,可以将图像数据处理中的某些问题换一个别的角度想办法,所以图像变换是图像处 ...
- iOS开发 改变UINavigationController的UINavigationBar的高度和背景图片
1.改变高度 自定义UINavigationBar的新类别: //UINavigationBar+BackgoundImage.h #import <Foundation/Foundation. ...