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. Oracle创建表

    //创建表,列的内容 -- Create tablecreate table T_HQ_PC( pinpai VARCHAR2(20) not null, xingh VARCHAR2(40), ji ...

  2. bzoj 2326: [HNOI2011]数学作业

    #include<cstdio> #include<iostream> #include<cstring> #include<cmath> #defin ...

  3. 【C语言学习】-04 一维数组、字符数组

    一维数组.数组排序.字符数

  4. 全国行政区划代码(json对象版)

    var area = {"110000":"北京市","110100":"北京市","110101" ...

  5. Problem C 链表

    Description 某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从头开始进行一至三报数,凡报 ...

  6. 合理利用 vs2013的性能分析跟诊断

    选择对应的项目==> 我正常是选择采样 就包括里面的一些耗时.  挺好用的. 可以根据热路径 还有访问的占比.知道哪个环节占用的访问时间 还有性能耗能多. 可以点进去 跟踪跟修改

  7. 在shell脚本中使用函数

    转载请标明:http://www.cnblogs.com/winifred-tang94/ 对于在脚本中重复使用的功能模块,可以封装成为函数. shell脚本中函数的定义可以使用如下两种方式: a. ...

  8. SharePoint 2016 的新特性概览(二)(What's New for IT Professionals in SharePoint Server 2016)

    博客地址:http://blog.csdn.net/FoxDave SharePoint 2016 的新特性 三. 监测和数据(Insights and Data) 实时数据监测,包括对使用情况.存储 ...

  9. Javascript 基础--JS函数(三)

    一.基本概念:未完成某一个功能的代码(语句,指令)的集合. 二.函数的调用方式: 2.1.函数名(传递参数1,传递参数2)   基本语法 function 函数名(参数列表){ //代码; retur ...

  10. JDK的下载与安装

    一.下载 在Oracle公司的官方网站(www.oracle.com)下载. 二.安装 1.双击运行JDK程序,弹出JDK安装导向窗口,点击“下一步” 2.点击“更改",将安装地址修改为 C ...