hdu 5655 CA Loves Stick
Posted lucky_少哖
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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)
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.
1≤T≤1000, 0≤a,b,c,d≤263−1
T testcases follow. Each testcase contains four integers a,b,c,d in a line, denoting the length of sticks.
1≤T≤1000, 0≤a,b,c,d≤263−1
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
打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\n"); 19 continue; 20 } 21 m=a[3]-a[1]-a[2]; 22 if(m>=a[0]) 23 printf("No\n"); 24 else 25 printf("Yes\n"); 26 } 27 return 0; 28 }
以上是关于hdu 5655 CA Loves Stick的主要内容,如果未能解决你的问题,请参考以下文章