HDU 5655 CA Loves Stick
来源:互联网 发布:电脑优化软件知乎 编辑:程序博客网 时间:2024/06/08 01:34
CA Loves Stick
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2934 Accepted Submission(s): 820
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 containsTdenoting the number of test cases.
T test cases follow. Each test case contains four integers a,b,c,din a line, denoting the length of sticks.
1<=T<=20,0<=a,b,c,d<=2^63-1
T test cases follow. Each test case contains four integers a,b,c,din a line, denoting the length of sticks.
1<=T<=20,0<=a,b,c,d<=2^63-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 11 1 9 2
Sample Output
YesNo
/*题目大意:给定四条线段的长度,判断能否拼接成一个四边形水题,判断条件为三条短边之和大于第四边,即a0+a1+a2>a3;有一个坑点,数据范围最大为2^63-1,若a0+a1+a2,有超long long的可能,通过简单的移项即可解决。*/#include<stdio.h>#include<iostream>#include<algorithm>using namespace std;int main(){ int t; long long a[10]; scanf("%d",&t); while(t--){ cin>>a[0]>>a[1]>>a[2]>>a[3]; sort(a,a+4); if(a[0]==0){ printf("No\n"); } else{ if(a[3]-a[2]-a[1]<a[0]){ printf("Yes\n"); } else{ printf("No\n"); } } } return 0;}
阅读全文
2 0
- 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
- CA Loves Stick HDU
- CA Loves Stick HDU
- hdu 5655 CA Loves Stick【思维】
- HDU-5655 CA Loves Stick(Water) 判断
- 【HDU 5655】【水题】CA Loves Stick
- hdu 5655 CA Loves Stick(水题)
- HDU-5655 CA Loves Stick(数学)
- BestCoder Round #78 1001/ hdu 5655 CA Loves Stick
- HDU 5655 CA Loves Stick(思维题目)【bestcoder】
- 杭电5655 CA Loves Stick
- HDOJ 5655-CA Loves Stick【思维题】
- 缓存淘汰算法--LRU算法
- 微信小程序拼团功能之表结构
- Learning Spatiotemporal Features with 3D Convolutional Networks译
- 在eclipse中给jar包导入javadoc文件
- Vector_list的使用和模拟
- HDU 5655 CA Loves Stick
- Invocation of init method failed; nested exception is org.activiti.engine.ActivitiException: couldn'
- 学习笔记 div span 垂直居中 + 水平居中
- 【UE4-节点】 美术学习笔记和经验_liuk718
- 自定义异常--继承RuntimeException
- MVP架构分包+OkHttp网络请求数据并展示到xrecyclerview上
- Web Server配置介绍
- 多线程和异步的区别
- Android OKHttp同步get请求,同步post请求,异步get请求,异步post请求