1 //大连网络赛 1006 2 // 吐槽:数据比较水。下面代码可以AC 3 // 但是正解好像是:排序后,前i项的和大于等于i*(i-1) 4 5 #include <bits/stdc++.h> 6 using namespace std; 7 #define LL long long 8 typedef pair<int,int> pii; 9 const double inf = 123456789012345.0; 10 const LL MOD =100000000LL; 11 const int N =1e4+10; 12 #define clc(a,b) memset(a,b,sizeof(a)) 13 const double eps = 1e-7; 14 void fre() {freopen("in.txt","r",stdin);} 15 void freout() {freopen("out.txt","w",stdout);} 16 inline int read() {int x=0,f=1;char ch=getchar();while(ch>‘9‘||ch<‘0‘) {if(ch==‘-‘) f=-1; ch=getchar();}while(ch>=‘0‘&&ch<=‘9‘) {x=x*10+ch-‘0‘;ch=getchar();}return x*f;} 17 18 int main(){ 19 int T; 20 while(~scanf("%d",&T)){ 21 while(T--){ 22 int n; 23 scanf("%d",&n); 24 LL sum=0; 25 int maxx=-1; 26 for(int i=1;i<=n;i++){ 27 int x; 28 scanf("%d",&x); 29 maxx=max(maxx,x); 30 sum+=x; 31 } 32 if((sum==n*(n-1))&&maxx<=(n-1)*2){ 33 puts("T"); 34 } 35 else puts("F"); 36 } 37 } 38 return 0; 39 }
时间: 2024-10-21 09:26:47