2 3 4 1 1 5 5 4 3 2 1
No Yes
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;
int main(){
long long n;
cin>>n;
long long m;
while(n--){
cin>>m;
int t,max=-1;
long long sum=0;
while(m--){
cin>>t;
if(t>max)max=t;
sum+=t;
}
sum-=max;
if(max<=1+sum)cout<<"Yes\n";
else cout<<"No\n";
}
return 0;
}
原文:http://blog.csdn.net/zp___waj/article/details/46041755