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.
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

BestCoder
Round #78 (div.2)

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 }
时间: 2024-02-27 05:27:37

hdu 5655 CA Loves Stick的相关文章

hdu-5655 CA Loves Stick(水题)

题目链接: CA Loves Stick Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 262144/262144 K (Java/Others) 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 quadrila

数学(GCD,计数原理)HDU 5656 CA Loves GCD

CA Loves GCD Accepts: 135 Submissions: 586 Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) 问题描述 CA喜欢是一个热爱党和人民的优秀同♂志,所以他也非常喜欢GCD(请在输入法中输入GCD得到CA喜欢GCD的原因). 现在他有N个不同的数,每次他会从中选出若干个(至少一个数),求出所有数的GCD然后放回去. 为了使自己不会无聊,CA会把每

hdu 5656 CA Loves GCD dp

CA Loves GCD Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Problem Description CA is a fine comrade who loves the party and people; inevitably she loves GCD (greatest common divisor) too. Now, there are N diffe

hdu 5656 CA Loves GCD

CA Loves GCD Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 882    Accepted Submission(s): 305 Problem Description CA is a fine comrade who loves the party and people; inevitably she loves GC

HDU 5658 CA Loves Palindromic(回文树)

CA Loves Palindromic Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 301    Accepted Submission(s): 131 Problem Description CA loves strings, especially loves the palindrome strings. One day

HDU 5655 四边形判断

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 Description CA loves to play with sticks.One day he receives four pieces of sticks, he

CA Loves GCD (BC#78 1002) (hdu 5656)

CA Loves GCD Accepts: 135 Submissions: 586 Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) 问题描述 CA喜欢是一个热爱党和人民的优秀同♂志,所以他也非常喜欢GCD(请在输入法中输入GCD得到CA喜欢GCD的原因). 现在他有N个不同的数,每次他会从中选出若干个(至少一个数),求出所有数的GCD然后放回去. 为了使自己不会无聊,CA会把每

hdu 4878 ZCC loves words(AC自动机+dp+矩阵快速幂+中国剩余定理)

hdu 4878 ZCC loves words(AC自动机+dp+矩阵快速幂+中国剩余定理) 题意:给出若干个模式串,总长度不超过40,对于某一个字符串,它有一个价值,对于这个价值的计算方法是这样的,设初始价值为V=1,假如这个串能匹配第k个模式串,则V=V*prime[k]*(i+len[k]),其中prime[k]表示第k个素数,i表示匹配的结束位置,len[k]表示第k个模式串的长度(注意,一个字符串可以多次匹配同意个模式串).问字符集为'A'-'Z'的字符,组成的所有的长为L的字符串,

hdu-5656 CA Loves GCD(dp+数论)

题目链接: CA Loves GCD Time Limit: 6000/3000 MS (Java/Others)     Memory Limit: 262144/262144 K (Java/Others) Problem Description CA is a fine comrade who loves the party and people; inevitably she loves GCD (greatest common divisor) too. Now, there are