CA Loves Stick HDU
来源:互联网 发布:indesign cs4 mac 编辑:程序博客网 时间:2024/06/05 02:06
**
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
2
1 1 1 1
1 1 9 2
Sample Output
Yes
No
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;}
阅读全文
0 0
- CA Loves Stick HDU
- CA Loves Stick HDU
- 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(Water) 判断
- 【HDU 5655】【水题】CA Loves Stick
- hdu 5655 CA Loves Stick(水题)
- HDU-5655 CA Loves Stick(数学)
- CA Loves Stick
- CA Loves Stick
- CA Loves Stick
- BestCoder Round #78 1001/ hdu 5655 CA Loves Stick
- 分拆素数和 HDU
- ubuntu python3 安装selenium及chrome的环境配置
- Sky数 HDU
- 王学岗RxJava(17)————实现图片的下载
- 【网页禁止选中文字】
- CA Loves Stick HDU
- 深入分析Java Web技术内幕 笔记
- Smarty模板引擎三总结
- Android05-常用控件2(Button-选择框)
- Largest prime factor HDU
- 青年歌手大奖赛_评委会打分 HDU
- 【简评】Loss Max-Pooling for Semantic Image Segmentation
- Spring事务的隔离级别
- Hive入门