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,从指针开始到 ...
随机推荐
- javascript 对象的复制
1. jQuery has a method that can be used to deep-clone objects, the$.extend() function. Let’s take a ...
- php 读取二进制文件
$file_pointer = fopen($file, "r"); $file_read = fread($file_pointer, filesize($file)); //$ ...
- php解决微信开发中用户昵称中的特殊字符与emoji表情写入mysql错误的问题
解决办法:将3个字节的特殊字符与emoji表情替换掉即可. $nickname = preg_replace('/xE0[x80-x9F][x80-xBF]'.'|xED[xA0-xBF][x80-x ...
- SpringMVC轻松学习-其他常用(四)
Spring MVC 3.0 深入 核心原理 1. 用户发送请求给服务器.url:user.do 2. 服务器收到请求.发现DispatchServlet可以处理.于是调用Disp ...
- windows下 nginx php 环境搭建
windows下配置nginx+php环境 刚看到nginx这个词,我很好奇它的读法(engine x),我的直译是“引擎x”,一般引“擎代”表了性能,而“x”大多出现是表示“xtras(额外的效果) ...
- dedecms标签使用
关键描述调用标签: <meta name="keywords" content="{dede:field name='keywords'/}">&l ...
- Mac下安装包管理平台Homebrew(Mac 10.12)
在终端上输入: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/maste ...
- C socket udp方式发数据
#define HOST_SERVER_IP "192.168.3.35" #define HOST_PORT 9501 #define SLEEP_TIME 1 #define ...
- The account '...' is no team with ID '...'
iOS升到9.2之后,有一个大坑,原先真机调试的开发者账号(未付费),连不了Xcode了,会弹出一个提示框提示你, The account '...' is no team with ID '...' ...
- IOS开发-UI学习-根据URL显示图片,下载图片的练习(button,textfield,image view,url,data)
编写一个如下界面,实现: 1.在文本输入框中输入一个网址,然后点击显示图片,图片显示到UIImageView中. 2.点击下载,这张显示的图片被下载到手机的Documents文件夹下的Dowmload ...