CA Loves Stick
Time limit:2000/1000 MS (java/others) Memory limit:262144/262144 K (java/others)
Total submission (s): 563 Accepted Submission (s): 202
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 containsTDenoting the number of testcases.
TTestcases follow. Each testcase contains four integersa,b,c,D In a line, denoting the length of sticks.
1≤T≤ 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
Source bestcoder Round #78 (Div.2) test instructions: Input four-sided long a,b,c,d to determine whether to form a quadrilateral: 1. Depending on the length of the edge, 0 2 is considered. Quadrilateral judging condition: the maximum edge is less than the sum of the other three sides in ascending order 3. According to the range of the edge length: a[0]>a[3]-a[2]-a[1] (addition processing will explode the data range should be removed by the subtraction process)
1#include <iostream>2#include <cstring>3#include <cstdio>4#include <map>5#include <queue>6#include <stack>7#include <algorithm>8 #definell __int649 #defineMoD 1Ten #definePI ACOs (-1.0) One using namespacestd; All a[5]; - intT; - intMain () the { -scanf"%d",&t); - for(intI=1; i<=t;i++) - { +scanf"%i64d%i64d%i64d%i64d", &a[0],&a[1],&a[2],&a[3]); -Sort (a,a+4); + //cout<<a[0]<<a[1]<<a[2]<<a[3]<<endl; A if(a[0]==0|| a[1]==0|| a[2]==0|| a[3]==0) atcout<<"No"<<Endl; - Else - { - if(a[0]>a[3]-a[2]-a[1]) -cout<<"Yes"<<Endl; - Else incout<<"No"<<Endl; - } to } + return 0; -}
HDU 56,554 Edge Shape judgment