题目链接;

Football Games

分析:

先将分数排序,然后

设当前队编号为p,设个指针为p+1,然后
p>1,每次p-=2,指针右移一位
p==1,指针指向的队-=1
p==0,从指针开始到n,都减去2
如果出现一个数小于0,判错,
如果最后一个数非0,盘错
其他判对
(如有反例请指正)

代码:

 #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <vector>
#include <bitset>
using namespace std; #define LL long long
#define F(i,a,b) for(int i=a;i<=b;++i)
#define R(i,a,b) for(int i=a;i<b;++i)
#define Rof(i,a,b) for (int i=(a),_##i=(b); i>=_##i; i--)
#define rek(i,a,b) for (int i=(a),_##i=(b); i>=_##i; i--)
#define mem(a,b) memset(a,b,sizeof(a))
#define cpy(a,b) memcpy(a,b,sizeof(b))
int t,n,i,a[];
int main()
{
//freopen("in.txt","r",stdin);
while(scanf("%d",&t)==)
{
while(t--)
{
scanf("%d",&n);
for(int i=;i<=n;++i) scanf("%d",a+i);
sort(a+,a++n);
for(i=;i<=n;++i)
{
if(a[i]<) {
puts("F");goto l;
}
int ans=i+;
while(a[i]>&&ans<=n)
{
a[i]-=;ans++;
}
if(a[i]>) {
puts("F");goto l;
}
else if(a[i]==)
{
a[ans++]-=;
}
for(int j=ans;j<=n;++j) a[j]-=;
}
puts("T");
l:;
}
}
return ;
}

HDU5873:Football Games的更多相关文章

  1. 16年大连网络赛 1006 Football Games

    题目链接:http://acm.hdu.edu.cn/contests/contest_showproblem.php?cid=725&pid=1006 Football Games Time ...

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

  3. 2016大连网络赛 Football Games

    Football Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) P ...

  4. 2016 ACM/ICPC Asia Regional Dalian Online Football Games

    Football Games Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)To ...

  5. Football Games(思维题)

    Problem Description A mysterious country will hold a football world championships---Abnormal Cup, at ...

  6. TOP100summit2017:Riot Games 李仁杰——大数据落地要找到数据和经验的平衡点

      壹佰案例:李仁杰老师您好,很荣幸您能参加第六届TOP100全球软件案例研究峰会,您在大数据和人工智能领域有非常丰富的经验,在这次大会上您将分享什么内容? 李仁杰:这次我主要分享的有两个方面. 一个 ...

  7. SPOJ:NT Games(欧拉函数)

    Katniss Everdeen after participating in Hunger Games now wants to participate in NT Games (Number Th ...

  8. POJ 3071:Football

    Football Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3600   Accepted: 1844 Descript ...

  9. 大连网络赛 1006 Football Games

    //大连网络赛 1006 // 吐槽:数据比较水.下面代码可以AC // 但是正解好像是:排序后,前i项的和大于等于i*(i-1) #include <bits/stdc++.h> usi ...

随机推荐

  1. UVa 10154 - Weights and Measures

    UVa 10154 - Weights and Measures I know, up on top you are seeing great sights,  But down at the bot ...

  2. 32-语言入门-32-Triangular Sums

    题目地址: http://acm.nyist.net/JudgeOnline/problem.php?pid=122    描述The nth Triangular number, T(n) = 1 ...

  3. BZOJ 2751 容易题

    题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=2751 题意:有一个数列A已知对于所有的A[i]都是1到n的自然数,并且知道对于一些A[i ...

  4. combobox远程加载数据的总结和Json数据的小结

    1.从后台返回请求加载Combobox下拉框数据 html部分1 <select name="mateBelongZ" id="mateBelongZID" ...

  5. Enable test automation in Testlink

    Enabling Test Automation in Testlink   Step 1: Change config settings in testlink config file Edit c ...

  6. 使用Less color函数创建专业网站配色方案

    Less提供了很多实用的函数专门用于定义和操作色彩.本文将介绍如何使用这些函数来 帮助你控制色彩,创造合适的色彩搭配,并且保持网站的一致性和专业性 color spinning spin()函数允许我 ...

  7. hadoop数据容易出现错误的地方

    最近在搞关于数据分析的项目,做了一点总结. 下图是系统的数据流向.容易出现错误的地方.1.数据进入hadoop仓库有四种来源,这四种是最基本的数据,简称ods,original data source ...

  8. unity3d 破解安装

    1.下载破解程序,执行生成unity_v4.x.ulf文件 2.断网 3.执行unity客户端,load该lisence文件即可 注意:安装unity客户端完成后,未破解,切记别打开unity客户端 

  9. HDU 5358 First One 求和(序列求和,优化)

    题意:给定一个含n个元素的序列,求下式子的结果.S(i,j)表示为seq[i...j]之和.注:对于log20可视为1.数据量n<=105. 思路:即使能够在O(1)的时间内求得任意S,也是需要 ...

  10. 凸优化简介 Convex Optimization Overview

    最近的看的一些内容好多涉及到凸优化,没时间系统看了,简单的了解一下,凸优化的两个基本元素分别是凸函数与凸包 凸集 凸集定义如下: 也就是说在凸集内任取两点,其连线上的所有点仍在凸集之内. 凸函数 凸函 ...