随便判了几个条件就过了,也不知道对不对的。
正解应该是:
$[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 "); continue; } bool fail=0; for(int i=1;i<=n;i++) if(a[i]>2*(n-1)) fail=1; if(fail) { printf("F "); continue; } printf("T "); } } return 0; }