更简单的排序
用的是在学冒泡排序之前看的一种
对三个数排序的方法
排序完再判断两边之和和第三边就好了
#include<stdio.h>
int main() {
int n;
double t,a,b,c;
scanf("%d",&n);
while(n) {
scanf("%lf %lf %lf",&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)
printf("YES\n");
else
printf("NO\n");
n--;
}
return 0;
}
题目地址:【杭电】[2039]三角形