只需判断任意两边之和大于第三边
出现wrong answer 的原因,是因为题目说的是证书,而非正整数,所以A,B,C的类型,应为double或者float。
#include <iostream>
using namespace std;
int main()
{
int M;
double A,B,C;
while(cin>>M)
{
for(int i=0;i<M;i++)
{
cin>>A>>B>>C;
if(A<=0.0||B<=0.0||C<=0.0)
cout<<"NO"<<endl;
else if(((A+B)>C&&(A+C)>B&&(B+C)>A))
{
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
}
system("pause");
return 0;
}