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. 苹果iPhone9、小米7…当曝光成为一门生意就没那么好玩了

    大众最乐此不疲的,当然就是以熊熊燃烧的八卦之心,去挖掘各种或为隐私,或为未知的那些事儿.为此,狗仔队.曝光人士等就受到了追捧.当然,也有对他们的各种嘲讽--而在智能手机行业,各种曝光更是乐此不疲的上演 ...

  2. 疯狂补贴的4G+  会是又一个资费陷阱吗?

     会是又一个资费陷阱吗?" title="疯狂补贴的4G+  会是又一个资费陷阱吗?"> 常言说得好,防火防盗防运营商--具有垄断性质的中国移动.联通.电信三大基础 ...

  3. Swizzling的使用

    在oc的runtime机制内有一类方法是可以用来实现类间的方法替换.解决了我们实际开发中诸多常规手段所无法解决的问题.关于Method Swizzling,这里有一篇介绍基本用法的文章 场景 最近出于 ...

  4. 全栈新视觉——前后端分离

    1234 前端工程化从单纯的 HTML/CSS/JavaScript,到 gulp/webpack 以及 node.js.可能还需要其他的插件 sass.less.vue.react.angular. ...

  5. Liferay7 Intellij IDEA 开发环境搭建

    一.安装Liferay插件 安装过程不在赘述,推荐两种安装方式: 通过Intellij插件市场安装 通过下载插件zip包安装 安装完成后,在项目板块中点鼠标右键,会出现Liferay菜单. 二.安装L ...

  6. Ueditor富文本编辑器--Ctrl V 粘贴后原有图片显示错误

    最近负责将公司官网从静态网站改版成动态网站,方便公司推广营销人员修改增加文案,避免官网文案维护过于依赖技术人员.在做后台管理系统时用到了富文本编辑器Ueditor,因为公司有一个阿里云文件资源服务器, ...

  7. APM监控工具Pinpoint搭建

    一:Pinpoint简介与架构图示 Pinpoint是什么Pinpoint是开源在github上的一款使用JAVA语言编写的APM监控工具,用于大规模分布式系统监控.它对性能的影响较小,只增加约3%的 ...

  8. vue+element 表单封成组件(1)

    作为一名刚接触vue不到一个月的菜鸟,思想还没有从操作DOM转变为数据驱动,看vue的代码处处别扭.组里为了让我熟悉vue交给了我一个将element 表单封装成组件的练手任务.由于开发过程中遇到的表 ...

  9. # 记一次Tomcat升级——幽灵猫

    一.背景 近日Tomcat被爆出幽灵猫漏洞,覆盖的版本从6-9全部中招,因此升级是当前能做的手段,那么就来说一下SpringBoot内置的Tomcat如何升级. 二.升级过程 1 下载对应的版本 To ...

  10. proteus pro 8.9 安装及汉化教程

    最近由于网上上课老师要求我们自己安装proteus这款仿真软件,所以笔者也安装了最新款版的proteus pro 8.9,分享给大家安装心得,也包含汉化过程,希望大家能用软件好好学习. 备注:感谢博主 ...