天天看點

杭電OJ_2039(C++版)

#include <iostream>
using namespace std;
int main(void){
	int m;
	double a,b,c,t;
	cin>>m;
	for(int i=0;i<m;i++){
		cin>>a>>b>>c;
		if(a>b){
			t=a;
			a=b;
			b=t;
		}
		if(b>c){
			t=b;
			b=c;
			c=t;
		}
		if(a>b){
			t=a;
			a=b;
			b=t;
		}
		if(a+b>c) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
} 
           

tips:容易在邊長資料類型出錯,不能隻是int,考慮小數也有,用double

OJ