http://acm.hdu.edu.cn/showproblem.php?pid=1205
水题
代码:
import java.util.*;
import java.math.BigInteger;
import java.math.BigDecimal;
;
interface forall {
static final int N = 1000005;
}
public class Main implements forall {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// BigInteger [] a = new BigInteger[122];
int T;
int n;
long[] a = new long[N];
T = in.nextInt();
while ((T--) > 0) {
n = in.nextInt();
long sum = 0;
long max = 0;
for (int i = 0; i < n; ++i) {
a[i] = in.nextLong();
sum += a[i];
max = Math.max(max, a[i]);
}
if ((max - 1) <= (sum - max)) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
}