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,从指针开始到 ...
随机推荐
- 对STM32的NVIC_PriorityGroupConfig使用及优先级分组方式理解(转)
源:http://blog.chinaunix.net/uid-22670933-id-3443085.html STM32有43个channel的settable的中断源:AIRC(Applicat ...
- VS+VA 开发NDK
工欲善其事,必先利其器. Android NDK开发环境,可选择VIM+插件.Eclipse+CDT等,这里介绍另一种选择:VS+VA 软件准备:Visual studio 2008 // 其他版本也 ...
- js中焦点的含义是什么
焦点即是光标 焦点是在页面上屏幕中闪动的的小竖线,鼠标点击可获得光标,Tab键可按照设置的Tabindex切换焦点
- Linux的iptables常用配置范例(2)
iptables -F #清除所有规则 iptables -X #清除所有自定义规则 iptables -Z #各项计数归零 iptables -P INPUT DROP #将input链 ...
- iOS之NSDictionary和NSArray以及NSMutableDictionary和NSMutableArray:将不再是问题
字典的key就相当于数组的下标,怎样操作数组你就学会了怎样才做字典:来感受一把 需要注意的是读取文件的类型要集合.plist文件的rooty:否则将不能读入文件 // 1.全国省市:得到的是省和市 / ...
- R语言相关工具
R: 下载 R语言的基础工具,包括R编译器,R控制台等 RStudio:下载 R程序集成开发环境.特别好用,包括一系列的集成工具. Rtools:下载 Windows环境下,编译R包的工具库.也可以用 ...
- (简单) POJ 1195 Mobile phones,二维树状数组。
Description Suppose that the fourth generation mobile phone base stations in the Tampere area operat ...
- shell 实例学习
安装crond:yum install crontabs (http://blog.163.com/victory_wxl/blog/static/14130530220115296180333/) ...
- 高仿xx教育网
2014年2月26日 16:24:50 好久没做 php了,考虑到老婆是教育行业,高仿一个教育辅导机构的网站 加油
- Android studio的那些bug
R文件无法编译: 1.Activity继承类AppCompatActivity有时候会报错 2.R文件找不到一般是layout文件夹下出错 3.sdk包问题 4.Gradle DSL method n ...