CA Loves Stick HDU - 5655
2017-06-18 01:44
260 查看
**
Problem
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 TT denoting the number of testcases.TT testcases follow. Each testcase contains four integers a,b,c,da,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
21 1 1 1
1 1 9 2
Sample Output
YesNo
ps:水题,用减法,加法会爆,先排序再比较
代码如下:#include<cstdio> #include<algorithm> using namespace std; int main () { long long n; scanf("%d", &n); while( n-- ) { long long a[5]; for(int i = 0; i <= 3; i++) scanf("%lld", &a[i]); if(a[0] == 0) { printf("No\n"); continue; } sort(a, a+4); // printf("%lld %lld %lld %lld\n", a[0], a[1], a[2], a[3]); if(a[3]-a[2]-a[1]<a[0]) printf("Yes\n"); else printf("No\n"); } return 0; }
相关文章推荐
- HDU 5655 CA Loves Stick
- hdu 5655 CA Loves Stick
- hdu 5655 CA Loves Stick
- HDU 5655 CA Loves Stick(思维题目)【bestcoder】
- HDU-5655 CA Loves Stick(Water) 判断
- HDU 5655 CA Loves Stick(四根棍子能否拼成四边形)
- CA Loves Stick HDU - 5655
- B - CA Loves Stick HDU - 5655
- HDU - 5655 CA Loves Stick(竟有四边形判定定理。。。)
- HDU 5655 CA Loves Stick
- hdu 5655 CA Loves Stick(简单题)(Bestcoder #78 1001)
- hdu 5655 CA Loves Stick
- HDU 5655 CA Loves Stick
- HDU - 5655 CA Loves Stick
- hdu 5655 CA Loves Stick(水题)
- HDU 5655 CA Loves Stick
- HDU 5655 CA Loves Stick 水题
- hdu 5655 CA Loves Stick
- HDU-5655 CA Loves Stick(数学)
- HDU 5655 CA Loves Stick 水题