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\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 }

 

转载于:https://www.cnblogs.com/pshw/p/5351406.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值