Football Games

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

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
 
Source
 题意:足球比赛,获胜方得2分 失败方不得分 平局各得一分 给你一个小组中m支球队的最终得分  判断得分是否合法
 题解:这个题目乱搞过的
m支球队得分为a1,a2.....am
a1=2*a11+1*a12+0*a13
a2=2*a21+1*a22+0*a23
...
...
am=2*am1+1*am2+0*am3
s1=a11+a21+.....am1
s2=a12+a22+.....am2
s3=a13+a23+.....am3
如果s1==s3&&s2%2==0则合法
下面有hack数据 这种方法错误
 
另外对于camp发出的正解 还是很好理解的
贴:

如果没有平手选项, 赢得加一分的话, 可以用Landau's Theorem判定, 这题稍微修改下这个定理就好了. 令s1,s2,...,sns_1,s_2,...,s_ns​1​​,s​2​​,...,s​n​​是他们的得分序列, 从小到大拍个序, 使得s1≤s2≤...≤sns_1 \le s_2 \le ... \le s_ns​1​​≤s​2​​≤...≤s​n​​, 那么这个序列合法, 当且仅当:

  1. s1+s2+...+si≥i(i−1)对于所有1≤i≤n−11 \le i \le n - 11≤i≤n−1
  2. s1+s2+...+sn=n(n−1)
 
 
错误代码
hack数据
1
4 0 0 6 6
 /******************************
code by drizzle
blog: www.cnblogs.com/hsd-/
^ ^ ^ ^
O O
******************************/
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#include<algorithm>
#include<queue>
#define ll __int64
using namespace std;
int n;
int s1,s2,s3;
int exm;
int m;
int main()
{
while(scanf("%d",&n)!=EOF)
{
for(int i=; i<=n; i++)
{
scanf("%d",&m);
s1=;
s2=;
s3=;
for(int j=; j<=m; j++)
{
scanf("%d",&exm);
int gg=;
s1=s1+exm/;
gg=gg+exm/;
exm%=;
s2=s2+exm;
gg=gg+exm;
exm=;
if(gg<(m-))
s3=s3+m--gg;
}
if((s2%)==&&(s1==s3))
cout<<"T"<<endl;
else
cout<<"F"<<endl;
}
}
return ;
}

正解代码

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include <ctime>
#include<queue>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<iomanip>
#include<cmath>
#include<bitset>
#define mst(ss,b) memset((ss),(b),sizeof(ss))
///#pragma comment(linker, "/STACK:102400000,102400000")
typedef long long ll;
typedef long double ld;
#define INF (1ll<<60)-1
#define Max 1e9
using namespace std;
int T;
int a[];
int main(){
while(scanf("%d",&T)!=EOF){
int n;
for(int cas=;cas<=T;cas++){
scanf("%d",&n);
for(int i=;i<=n;i++) scanf("%d",&a[i]);
sort(a+,a+n+);
ll sum=;
int f=;
for(int i=;i<=n;i++){
sum+=a[i];
if(sum<1LL*(i-)*i){
f=;
break;
}
}
if(sum!=1LL*(n-)*n) f=;
if(f) printf("F\n");
else printf("T\n");
}
}
return ;
}

2016 ACM/ICPC Asia Regional Dalian Online 1006 /HDU 5873的更多相关文章

  1. 2016 ACM/ICPC Asia Regional Dalian Online 1002/HDU 5869

    Different GCD Subarray Query Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K ( ...

  2. HDU 5874 Friends and Enemies 【构造】 (2016 ACM/ICPC Asia Regional Dalian Online)

    Friends and Enemies Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Othe ...

  3. HDU 5875 Function 【倍增】 (2016 ACM/ICPC Asia Regional Dalian Online)

    Function Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total ...

  4. 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 ...

  5. HDU 5876 Sparse Graph 【补图最短路 BFS】(2016 ACM/ICPC Asia Regional Dalian Online)

    Sparse Graph Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)To ...

  6. hdu 5868 2016 ACM/ICPC Asia Regional Dalian Online 1001 (burnside引理 polya定理)

    Different Circle Permutation Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K ...

  7. 2016 ACM/ICPC Asia Regional Shenyang Online 1003/HDU 5894 数学/组合数/逆元

    hannnnah_j’s Biological Test Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K ...

  8. 2016 ACM/ICPC Asia Regional Shenyang Online 1009/HDU 5900 区间dp

    QSC and Master Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) ...

  9. 2016 ACM/ICPC Asia Regional Shenyang Online 1007/HDU 5898 数位dp

    odd-even number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)T ...

随机推荐

  1. POJ 2632 Crashing Robots 模拟 难度:0

    http://poj.org/problem?id=2632 #include<cstdio> #include <cstring> #include <algorith ...

  2. 一模 (2) day1

    第一题: 题目大意: 设 2n 张牌分别标记为 1, 2, ..., n, n+1, ..., 2n,初始时这 2n 张牌按其标号从小到大排列.经一次洗牌后,原来的排列顺序变成 n+1, 1, n+2 ...

  3. 神奇的Noip模拟试题 T3 科技节 位运算

    3 科技节 (scifest.pas/.c/.cpp) [问题描述] 一年一度的科技节即将到来.同学们报名各项活动的名单交到了方克顺校长那,结果校长一看皱了眉头:这帮学生热情竟然如此高涨,每个人都报那 ...

  4. IT公司100题-1-二叉树转换为双链表

    问题描述: 输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表.要求不能创建任何新的结点,只调整指针的指向. 10   /   \  6      14/  \    /   \4   8 1 ...

  5. Android 圆形ProgressBar风格设置

    Android系统自带的ProgressBar风格不是很好,如果想自己设置风格的话,一般有几种方法.首先介绍一下第一种方法通过动画实现.在res的anim下创建动画资源loading.xml: < ...

  6. Hadoop中常用的InputFormat、OutputFormat(转)

    Hadoop中的Map Reduce框架依赖InputFormat提供数据,依赖OutputFormat输出数据,每一个Map Reduce程序都离不开它们.Hadoop提供了一系列InputForm ...

  7. SharePoint 2013 Nintex Workflow 工作流帮助(九)

    博客地址 http://blog.csdn.net/foxdave 前叙:假期结束了,知道为什么假期如此短暂吗?因为假期的每天只有半天.春节过完了,新的一年开始了,大家或许之前在新年的时候都许下了自己 ...

  8. SharePoint 2013 Nintex Workflow 工作流帮助(二)

    博客地址 http://blog.csdn.net/foxdave 工作流动作 1. Action Set(Logic and flow分组) 它是一个工作流的集合,可以理解为容器的东西.所以它本身并 ...

  9. 知道创宇研发技能表v3.0

    知道创宇研发技能表v3.0 2015/8/21 发布 by @知道创宇(www.knownsec.com) @余弦 & 404团队 后续动态请关注微信公众号:Lazy-Thought 说明 关 ...

  10. Ubuntu 14.10 下安装SVN

    本文主要介绍SVN独立服务器的的安装和简单配置:1.安装 # sudo apt-get install subversion 测试安装是否成功: # svnserve --version 回车显示版本 ...