A. New Year Garland

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Polycarp is sad — New Year is coming in few days but there is still no snow in his city. To bring himself New Year mood, he decided to decorate his house with some garlands.

The local store introduced a new service this year, called "Build your own garland". So you can buy some red, green and blue lamps, provide them and the store workers will solder a single garland of them. The resulting garland will have all the lamps you provided put in a line. Moreover, no pair of lamps of the same color will be adjacent to each other in this garland!

For example, if you provide 33 red, 33 green and 33 blue lamps, the resulting garland can look like this: "RGBRBGBGR" ("RGB" being the red, green and blue color, respectively). Note that it's ok to have lamps of the same color on the ends of the garland.

However, if you provide, say, 11 red, 1010 green and 22 blue lamps then the store workers won't be able to build any garland of them. Any garland consisting of these lamps will have at least one pair of lamps of the same color adjacent to each other. Note that the store workers should use all the lamps you provided.

So Polycarp has bought some sets of lamps and now he wants to know if the store workers can build a garland from each of them.

Input

The first line contains a single integer tt (1≤t≤1001≤t≤100) — the number of sets of lamps Polycarp has bought.

Each of the next tt lines contains three integers rr, gg and bb (1≤r,g,b≤1091≤r,g,b≤109) — the number of red, green and blue lamps in the set, respectively.

Output

Print tt lines — for each set of lamps print "Yes" if the store workers can build a garland from them and "No" otherwise.

Example
Input

Copy
3
3 3 3
1 10 2
2 1 1
Output

Copy
Yes
No
Yes
Note

The first two sets are desribed in the statement.

The third set produces garland "RBRG", for example.

既然首尾颜色可以相同,那怎么能叫花环呢

那应该就是一个链啊

RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

BBBBBBBBBBBBBBBBBBBBBBBBBB

GGGGGGGGGGGGGGGGGGGGG

RBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRRRRRRRRRRRRR;

RBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRGRGRGRGRGRG

↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

简明扼要的表达了思路

【这题是大佬直接讲的他的思路】(白嫖思路)

思路如下:

首先先排序,先把最大的和第二大的插空(RBRBRBRBRBRBRBRRRRRRRRR)

这时候肯定多了一些最大的那个颜色,这时候就把最少的颜色拿来补

我们只要知道最少的颜色满足的某个区间,就可以快乐输出了、

a[0]>=abs(a[1]-a[2])-1且a[0]<=a[1]+a[2]+abs(a[1]-a[2])“a[0]表示最小的数”

不过a[0]>***的式子很多余。。。。。(不管了,我好不容易推出来的式子我就要加上)

 #include <bits/stdc++.h>

 using namespace std;

 int main()
{
long long a[];
int t;
cin>>t;
while(t--){
cin>>a[]>>a[]>>a[];
sort(a,a+);
if(a[]>=abs(a[]-a[])-&&a[]<=a[]+a[]+abs(a[]-a[]))
14     cout<<"yes"<<'\n';
else cout<<"no"<<'\n';
}
return ;
}

CF codeforces A. New Year Garland【Educational Codeforces Round 79 (Rated for Div. 2)】的更多相关文章

  1. 【Educational Codeforces Round 38 (Rated for Div. 2)】 Problem A-D 题解

    [比赛链接] 点击打开链接 [题解] Problem A Word Correction[字符串] 不用多说了吧,字符串的基本操作 Problem B  Run for your prize[贪心] ...

  2. 【Educational Codeforces Round 53 (Rated for Div. 2)】

    A:https://www.cnblogs.com/myx12345/p/9853775.html B:https://www.cnblogs.com/myx12345/p/9853779.html ...

  3. 【Educational Codeforces Round 49 (Rated for Div. 2) 】

    A:https://www.cnblogs.com/myx12345/p/9843826.html B:https://www.cnblogs.com/myx12345/p/9843869.html ...

  4. Educational Codeforces Round 79 (Rated for Div. 2) Finished (A-D)

    如果最大值比剩余两个加起来的总和+1还大,就是NO,否则是YES #include<bits/stdc++.h> using namespace std; int main(){ int ...

  5. Educational Codeforces Round 79 (Rated for Div. 2) - D. Santa's Bot(数论)

    题意:有$n$个孩子,第$i$个孩子有$k[i]$件想要的礼物,第$j$个礼物为$a[i][j]$,现在随机挑一个孩子,从他想要的礼物里面随机挑一个,然后送给另一个孩子$($这个孩子可以和第一个孩子是 ...

  6. Educational Codeforces Round 65 (Rated for Div. 2)题解

    Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include ...

  7. Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块

    Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块 [Problem Description] ​ ...

  8. Educational Codeforces Round 71 (Rated for Div. 2)-E. XOR Guessing-交互题

    Educational Codeforces Round 71 (Rated for Div. 2)-E. XOR Guessing-交互题 [Problem Description] ​ 总共两次询 ...

  9. Educational Codeforces Round 72 (Rated for Div. 2)-D. Coloring Edges-拓扑排序

    Educational Codeforces Round 72 (Rated for Div. 2)-D. Coloring Edges-拓扑排序 [Problem Description] ​ 给你 ...

随机推荐

  1. 重大改革!Python将被加入高考科目!

    未来大学生将分为两种:一种是编程好的人,另一种是编程超好的人. Python 将被纳入高考科目 近期,浙江省信息技术课程改革方案出台,Python 确定进入浙江省信息技术高考,从2018年起浙江省信息 ...

  2. 百度地图API:使用百度定位

    准备工作: 1.申请百度地图API 2.下载百度地图的SDK 3.将SDK包中的BaiduLBS_Android.jar文件放到,项目里的app/libs里面 4.在src/main目录下创建一个名为 ...

  3. 【底层原理:深入理解计算机系统】#1 一切从"hello world"说起 (一)

    计算机系统是由硬件和系统软件组成的,他们共同工作来运行应用程序.虽然系统的具体实现方式随着时间不断的在变化,但是系统的内在概念却没有改变的. 所有的计算机硬件和软件有着相似的结构和功能.这个系列专题便 ...

  4. Mac 常见命令行

    1. unrar解压rar文件 1.1 安装命令:brew install unrar 1.2 解压文件:unrar x test.rar 2. 创建文件夹:mkdir 文件夹名 3. 删除文件夹: ...

  5. Magisk了解以及简单的模块制作

    Magisk,就是刷机经常会需要使用的,也是就是我们说的面具或者脸谱.因为它的logo就是面具或者说脸谱.我们先简单了解一下: XDA上论坛的说明:Magisk - The Universal Sys ...

  6. PDF 相关操作

    去年一年偷了下懒, 博客写了一点就没写了, 还好一些大的flag完成了.  花了半年的空余时间, 培养了一门兴趣爱好.   自己在为人处世上还是不够圆滑啊, 也难怪.   自己当初选择走技术这条路的初 ...

  7. GPUImage学习总结

    GPUImage是iOS上一个基于OpenGL进行图像处理的开源框架,内置大量滤镜,架构灵活,可以在其基础上很轻松地实现各种图像处理功能. GPUImgae特性 1,丰富的输入组件 摄像头.图片.视频 ...

  8. cordova+vue打包ios调用相机闪退解决

    cordova+vue项目打包android,打开相机正常使用,但是打包ios后,需要多几个配置,才能打开,否则当调用的时候会闪退,上配置图 需要在选中的文件里面添加 <key>NSCam ...

  9. JZOJ 5286. 【NOIP2017提高A组模拟8.16】花花的森林 (Standard IO)

    5286. [NOIP2017提高A组模拟8.16]花花的森林 (Standard IO) Time Limits: 1000 ms Memory Limits: 131072 KB Descript ...

  10. Error : Failed to get convolution algorithm. This is probably because cuDNN failed to initialize

    记录一下: 报错:# Error : Failed to get convolution algorithm. This is probably because cuDNN failed to ini ...