三角形
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 69908 Accepted Submission(s):
23479
<1000;
1 2
2 2 2
/*import java.util.*;
class Main{
public static void main(String args[])
{Scanner cin=new Scanner(System.in);
int n=cin.nextInt();
while(n-->0)
{double []a=new double[3];
double t;
for(int i=0;i<3;i++)
a[i]=cin.nextDouble();
for(int i=0;i<2;i++)
{for(int j=i+1;j<3;j++)
{if(a[i]>a[j])
{t=a[i];
a[i]=a[j];
a[j]=t;
}
}
}
if(a[0]+a[1]>a[2]&&a[2]-a[0]<a[1])
System.out.println("YES");
else
System.out.println("NO");
}
}
}*/
import java.util.*;
class Main{
public static void main(String args[])
{Scanner cin=new Scanner(System.in);
int n=cin.nextInt();
while(n-->0)
{double a,b,c;
a=cin.nextDouble();
b=cin.nextDouble();
c=cin.nextDouble();
if(a+b>c&&b+c>a&&a+c>b)
System.out.println("YES");
else
System.out.println("NO");
}
}
}
以上两个都可以,但第二个代码和复杂度都要比第一个的小;特别注意输入要用双精度的数值;