'commit'
This commit is contained in:
23
TangDou/Topic/HDU1205.cpp
Normal file
23
TangDou/Topic/HDU1205.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include <bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define int long long
|
||||
const int N = 1000010;
|
||||
int a[N];
|
||||
signed main() {
|
||||
int T;
|
||||
cin >> T;
|
||||
while (T--) {
|
||||
int n, sum, mx;
|
||||
cin >> n;
|
||||
sum = 0, mx = 0;
|
||||
for (int j = 0; j < n; j++) {
|
||||
cin >> a[j];
|
||||
sum += a[j];
|
||||
mx = mx < a[j] ? a[j] : mx;
|
||||
}
|
||||
if ((sum - mx) >= (mx - 1))
|
||||
puts("Yes");
|
||||
else
|
||||
puts("No");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user