mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 5873_kopyh.cpp
From http://blog.csdn.net/kopyh/article/details/52496667
This commit is contained in:
parent
038880cfb5
commit
038d6e0819
38
HDOJ/5873_kopyh.cpp
Normal file
38
HDOJ/5873_kopyh.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
//kopyh
|
||||
#include <bits/stdc++.h>
|
||||
#define INF 0x3f3f3f3f
|
||||
#define MOD 1000000007
|
||||
#define N 1123456
|
||||
using namespace std;
|
||||
long long n,m,sum,res,flag,a[N];
|
||||
int main()
|
||||
{
|
||||
#ifndef ONLINE_JUDGE
|
||||
freopen("test.txt","r",stdin);
|
||||
#endif
|
||||
int i,j,k,cas,T,t,x,y,z;
|
||||
while(scanf("%I64d",&n)!=EOF)
|
||||
while(n--)
|
||||
{
|
||||
flag=1; sum=0;
|
||||
scanf("%I64d",&m);
|
||||
for(i=0;i<m;i++)
|
||||
{
|
||||
scanf("%I64d",&a[i]);
|
||||
sum+=a[i];
|
||||
}
|
||||
if(sum!=m*(m-1))flag=0;
|
||||
else
|
||||
{
|
||||
sort(a,a+m);
|
||||
res=0;
|
||||
for(i=0;i<m;i++)
|
||||
{
|
||||
res+=a[i];
|
||||
if(res<i*(i+1)){flag=0;break;}
|
||||
}
|
||||
}
|
||||
printf(flag?"T\n":"F\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user