题目链接:

http://acm.hdu.edu.cn/showproblem.php?pid=5656

CA Loves Stick

Accepts: 381   Submissions: 3204

Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 262144/262144 K (Java/Others)

问题描述

CA喜欢玩木棍。

有一天他获得了四根木棍,他想知道用这些木棍能不能拼成一个四边形。(四边形定义:https://en.wikipedia.org/wiki/Quadrilateral)

输入描述

第一行TT,表示有TT组数据。

接下来TT组数据,每组数据包含四个整数a,b,c,da,b,c,d,分别为四根木棍的长度。

1 \le T \le 1000,~0 \le a,b,c,d \le 2^{63}-11≤T≤1000, 0≤a,b,c,d≤2​63​​−1

输出描述

对于每个数据,如果能拼成一个四边形,输出“Yes”;否则输出“No”(不包括双引号)。

输入样例

2

1 1 1 1

1 1 9 2

输出样例

Yes

No

题解:

-2^63:  xb1000...0(63个0) ,即 -0;(LL)1<<63

   0:  xb0000...0(64个0),即+0;

  最小三边和大于最大边即可构成4边形

  但数据很多会爆,所以要做些处理

代码:

#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std; typedef long long LL;
const LL t_63 = ((LL) << );
LL a[]; int main() {
int tc;
scanf("%d", &tc);
LL x = ;
while (tc--) {
for (int i = ; i < ; i++) scanf("%lld", a + i);
sort(a, a + );
if (a[]> && a[] - t_63 + a[]>a[] - a[] - t_63) {
printf("Yes\n");
}
else printf("No\n");
}
return ;
}
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std; typedef long long LL;
LL a[]; int main() {
int tc;
scanf("%d", &tc);
while (tc--) {
for (int i = ; i < ; i++) scanf("%lld", a + i);
sort(a, a + );
if (a[]>&&a[]>a[] - a[]-a[]) {
printf("Yes\n");
}
else printf("No\n");
}
return ;
}

HDU 5655 CA Loves Stick 水题的更多相关文章

  1. hdu 5655 CA Loves Stick

    CA Loves Stick Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) ...

  2. hdu 5268 ZYB loves Score 水题

    ZYB loves Score Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?p ...

  3. hdu 5272 Dylans loves numbers 水题

    Dylans loves numbers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem. ...

  4. HDU 5645 DZY Loves Balls 水题

    DZY Loves Balls 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5645 Description DZY loves playing b ...

  5. hdu 5656 CA Loves GCD(n个任选k个的最大公约数和)

    CA Loves GCD  Accepts: 64  Submissions: 535  Time Limit: 6000/3000 MS (Java/Others)  Memory Limit: 2 ...

  6. HDU 5538 L - House Building 水题

    L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  7. HDU 5578 Friendship of Frog 水题

    Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...

  8. HDU 5590 ZYB's Biology 水题

    ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...

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

    CA Loves GCD Accepts: 135 Submissions: 586 Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 2621 ...

随机推荐

  1. 002---rest_framework认证组件

    rest_framework认证组件 问题:有些API,需要用户登录才能访问,有些无需登录就能访问. 解决: a. 创建两个模型类:UserInfo---OneToOne---UsetToken b. ...

  2. bat脚本,winscp,shell加mysql存储过程实现mysql单条数据迁移

    起因 公司有个任务,需要迁移mysql中的单条数据.从公司的dev环境到staging环境,dev环境的mysql安装在windows server 2012 R2下,stage是aws的服务器不能直 ...

  3. Asp.Net实现在线人数统计 (转)

    原文件:http://blog.csdn.net/wxd_860825/article/details/4589292 利用Application对象和Session对象可以统计当前在线用户数量. 注 ...

  4. 20155334 2016-2017-2《Java程序设计》课程总结

    20155334 2016-2017-2<Java程序设计>课程总结 1. 每周作业链接汇总 题目 主要内容 二维码 预备作业1 不知道所以然的第一次博客 预备作业2 有关之前的C语言的调 ...

  5. 【转载】ID3DXSPRITE接口简单使用

    原文:ID3DXSPRITE接口简单使用 前些日子一直研究DDraw,毕竟是DirectX7的东西了,所以转手用DirectD3D9,用了Surface进行绘图,可是怎么做透明色也都是不行loadfr ...

  6. day 2 异常传递 ,抛出

    1.异常的传递 def test1(): print("---test1--") print(num) print('---test1 over---') def test2(): ...

  7. 【LG3237】[HNOI2014]米特运输

    题面 洛谷 题解 代码 #include <iostream> #include <cstdio> #include <cstdlib> #include < ...

  8. iOS 的音频播放

    一.Audio Toolbox 1.使用代码 #import <AudioToolbox/AudioToolbox.h> AudioServicesPlaySystemSound(1106 ...

  9. iOS 影音新格式 HEIF HEVC

    苹果在 iOS 11 的发布会上,推出了两种新的媒体格式 HEIF HEVC,都是为了保证画质的情况下,大大减少视频.照片的大小. 一.简介 HEVC全称 High Efficiency Video ...

  10. Android 学习1

    使用eclipse做为开发IDE, 导包快捷键 在显红的地方按shift+ctrl+o 另外自动补全使用alt+/