2 3 4 1 1 5 5 4 3 2 1
No Yes
#include<iostream> #include<cstring> using namespace std; typedef long long ll; int main(){ int T; cin>>T; while(T--){ int n; cin>>n; ll sum=0,max=0,num; for(int i=0;i<n;i++){ cin>>num; sum+=num; if(num>max) max=num; } if(sum-max>=max-1) cout<<"Yes\n"; else cout<<"No\n"; } return 0; }
原文地址:http://blog.csdn.net/hyccfy/article/details/41652029