2016 ACM/ICPC Asia Regional Dalian Online 1006 /HDU 5873
Football Games
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 439 Accepted Submission(s): 157
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.
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
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.
如果没有平手选项, 赢得加一分的话, 可以用Landau's Theorem判定, 这题稍微修改下这个定理就好了. 令s1,s2,...,sns_1,s_2,...,s_ns1,s2,...,sn
是他们的得分序列, 从小到大拍个序, 使得s1≤s2≤...≤sns_1 \le s_2 \le ... \le s_ns1≤s2≤...≤sn
, 那么这个序列合法, 当且仅当:
s1+s2+...+si≥i(i−1)
对于所有1≤i≤n−11 \le i \le n - 11≤i≤n−1
s1+s2+...+sn=n(n−1)
/******************************
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的更多相关文章
- 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 ( ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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) ...
- 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 ...
随机推荐
- Oracle创建表
//创建表,列的内容 -- Create tablecreate table T_HQ_PC( pinpai VARCHAR2(20) not null, xingh VARCHAR2(40), ji ...
- bzoj 2326: [HNOI2011]数学作业
#include<cstdio> #include<iostream> #include<cstring> #include<cmath> #defin ...
- 【C语言学习】-04 一维数组、字符数组
一维数组.数组排序.字符数
- 全国行政区划代码(json对象版)
var area = {"110000":"北京市","110100":"北京市","110101" ...
- Problem C 链表
Description 某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从头开始进行一至三报数,凡报 ...
- 合理利用 vs2013的性能分析跟诊断
选择对应的项目==> 我正常是选择采样 就包括里面的一些耗时. 挺好用的. 可以根据热路径 还有访问的占比.知道哪个环节占用的访问时间 还有性能耗能多. 可以点进去 跟踪跟修改
- 在shell脚本中使用函数
转载请标明:http://www.cnblogs.com/winifred-tang94/ 对于在脚本中重复使用的功能模块,可以封装成为函数. shell脚本中函数的定义可以使用如下两种方式: a. ...
- SharePoint 2016 的新特性概览(二)(What's New for IT Professionals in SharePoint Server 2016)
博客地址:http://blog.csdn.net/FoxDave SharePoint 2016 的新特性 三. 监测和数据(Insights and Data) 实时数据监测,包括对使用情况.存储 ...
- Javascript 基础--JS函数(三)
一.基本概念:未完成某一个功能的代码(语句,指令)的集合. 二.函数的调用方式: 2.1.函数名(传递参数1,传递参数2) 基本语法 function 函数名(参数列表){ //代码; retur ...
- JDK的下载与安装
一.下载 在Oracle公司的官方网站(www.oracle.com)下载. 二.安装 1.双击运行JDK程序,弹出JDK安装导向窗口,点击“下一步” 2.点击“更改",将安装地址修改为 C ...