HDU 5873 Football Games

Posted Fighting Heart

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU 5873 Football Games相关的知识,希望对你有一定的参考价值。

随便判了几个条件就过了,也不知道对不对的。

正解应该是:

$[1].$${s_1} + {s_2} + {s_3} + ...... + {s_n} = n(n - 1)$

$[2].$${s_1} + {s_2} + {s_3} + ...... + {s_i} ≥ i(i - 1)$

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-6;
void File()
{
    freopen("D:\\in.txt","r",stdin);
    freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
    char c=getchar(); x=0;
    while(!isdigit(c)) c=getchar();
    while(isdigit(c)) {x=x*10+c-0; c=getchar();}
}

const int maxn=200000;
int T,n,m,sum,a[maxn];

int main()
{
    while(~scanf("%d",&T))
    {
        while(T--)
        {
            scanf("%d",&n); sum=0; m=0;
            for(int i=1;i<=n;i++) scanf("%d",&a[i]),sum=sum+a[i];

            if(sum!=n*(n-1)) { printf("F\n"); continue; }
            
            bool fail=0;
            for(int i=1;i<=n;i++) if(a[i]>2*(n-1)) fail=1;
            if(fail) { printf("F\n"); continue; }

            printf("T\n");
        }
    }
    return 0;
}

 

以上是关于HDU 5873 Football Games的主要内容,如果未能解决你的问题,请参考以下文章

HDU 5873 Football Games(竞赛图兰道定理)

HDU 5873 Football Games 模拟 (2016 ACM/ICPC Asia Regional Dalian Online)

2016 ACM/ICPC Asia Regional Dalian Online 1006 Football Games

大连网络赛 1006 Football Games

2016大连网络赛 Football Games

2016 ACM/ICPC Asia Regional Dalian Online 1006 /HDU 5873