hdu 5655 CA Loves Stick

CA Loves Stick

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 612    Accepted Submission(s): 214


Problem Description
CA loves to play with sticks.
One day he receives four pieces of sticks, he wants to know these sticks can spell a quadrilateral.
(What is quadrilateral? Click here: https://en.wikipedia.org/wiki/Quadrilateral)
 
Input
First line contains T denoting the number of testcases.
T testcases follow. Each testcase contains four integers a,b,c,d in a line, denoting the length of sticks.
1T1000, 0a,b,c,d2631
 
Output
For each testcase, if these sticks can spell a quadrilateral, output "Yes"; otherwise, output "No" (without the quotation marks).
 
Sample Input
2
1 1 1 1
1 1 9 2
 
Sample Output
Yes
No
 
Source
 
Recommend
wange2014   |   We have carefully selected several similar problems for you:  5659 5658 5657 5654 5653 
 
打BC的时候遇到的第一题,本来很简单的一道题,数据范围有点坑,错了三次,坑死宝宝了。
四边形定则:三边之后一定要大于第四边。
 
题意:给你四条边的长度,判断是否是个四边形,是则Yes,不是则No。注意数据的范围!!!
 
附上代码:
 
 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstring>
 4 #include <algorithm>
 5 using namespace std;
 6 int main()
 7 {
 8     __int64 a[5],m;
 9     int T,i,j;
10     scanf("%d",&T);
11     while(T--)
12     {
13         for(i=0; i<4; i++)
14             scanf("%I64d",&a[i]);
15         sort(a,a+4);
16         if(a[0]==0)
17         {
18             printf("No
");
19             continue;
20         }
21         m=a[3]-a[1]-a[2];
22         if(m>=a[0])
23             printf("No
");
24         else
25             printf("Yes
");
26     }
27     return 0;
28 }
原文地址:https://www.cnblogs.com/pshw/p/5351406.html