注意long long 超范围和长度为0的情况。
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
int exam(long long a, long long b, long long c, long long d) {
if(b + c < 0) return 1;
if(c + d < 0) return 1;
if(b + d < 0) return 1;
if(b + c + d < 0) return 1;
if(a < b + c + d) return 1;
return 0;
}
int main() {
int T;
scanf("%d", &T);
long long a, b, c, d;
while(T--) {
scanf("%I64d %I64d %I64d %I64d", &a, &b, &c, &d);
if(a != 0 && b != 0 && c != 0 && d != 0 && exam(a, b, c, d) && exam(b, a, c, d) && exam(c, a, b, d) && exam(d, a, b, c)) {
printf("Yes\n");
}
else printf("No\n");
}
return 0;
}