其实就是三条最小边之和大于第四边,也就是最小两个边之和小于最大两个边的差,此题数据很大如果强行前三边相加的话,会爆精度,会一直wa,可以unsiged long long 进行两边相加和相减,也可以str[3]-str[2]-str[1]<str[0],这样更稳一些,不过我下面这写法就已经ac了
#include <stdio.h>
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <string>
using namespace std;
int main()
{
int t;
unsigned long long str[4];
cin>>t;
while(t--)
{
for(int i=0;i<4;i++)
cin>>str[i];
sort(str,str+4);
if(str[0]==0) cout<<"No"<<endl;
else if(str[0]+str[1]>str[3]-str[2]) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
}