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 Descriptionca 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)
Inputfirst Line containsT Denoting the number of testcases.
T Testcases follow. Each testcase contains four integersa,b,c,D In a line, denoting the length of sticks.
1≤T≤1000, 0≤a,b,c,d≤2-1
Outputfor each testcase, if these sticks can spell a quadrilateral, output "Yes"; Otherwise, output "No" (without the quotation marks).
Sample Input21 1 1 11 1 9 2
Sample Outputyesno
Sourcebestcoder Round #78 (Div.2)
Recommendwange2014 | We have carefully selected several similar problems for you:5659 5658 5657 5654 5653 hit BC when the first problem encountered, originally very simple a problem, the data range a bit pit, the wrong three Times, the pit of the baby is dead. Quadrilateral rule: After three sides must be greater than the four sides. Test instructions: give you the length of four sides, determine whether it is a quadrilateral, yes, not No. Pay attention to the range of data!!! Attached code:
1#include <iostream>2#include <cstdio>3#include <cstring>4#include <algorithm>5 using namespacestd;6 intMain ()7 {8__int64 a[5],m;9 intt,i,j;Tenscanf"%d",&T); One while(t--) A { - for(i=0; i<4; i++) -scanf"%i64d",&a[i]); theSort (a,a+4); - if(a[0]==0) - { -printf"no\n"); + Continue; - } +m=a[3]-a[1]-a[2]; A if(m>=a[0]) atprintf"no\n"); - Else -printf"yes\n"); - } - return 0; -}
HDU 5655 CA Loves Stick