CF1279A.New Year Garland

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

波利卡普很伤心——新年就要到了,但他的城市却依然没有下雪。为了让自己感受到新年的气氛,他决定用一些彩灯串来装饰自己的房子。

今年,当地商店推出了一项新服务,名为“定制彩灯串”。你可以购买若干红、绿、蓝三种颜色的灯泡,并将它们提供给商店。店员会将你提供的所有灯泡焊接成一条彩灯串。最终得到的彩灯串中,所有灯泡将被排成一行,且任意两个相邻的灯泡颜色均不相同!

例如,如果你提供了 33 个红色、33 个绿色和 33 个蓝色灯泡,那么最终的彩灯串可以是这样的:"RGBRBGBGR"(其中 "R"、"G"、"B" 分别代表红、绿、蓝)。注意:彩灯串两端的灯泡颜色可以相同。

然而,如果你提供了,比如说 11 个红色、1010 个绿色和 22 个蓝色灯泡,那么店员就无法用这些灯泡制作出任何满足条件的彩灯串。因为由这些灯泡组成的任意彩灯串中,都至少存在一对相邻的同色灯泡。注意:店员必须使用你提供的全部灯泡。

因此,波利卡普已经购买了几组灯泡,现在他想知道:对于每一组灯泡,店员是否都能制作出一条满足条件的彩灯串?

输入格式

The first line contains a single integer tt (1≤t≤1001 \le t \le 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 \le r, g, b \le 10^9) — the number of red, green and blue lamps in the set, respectively.

第一行包含一个整数 tt(1≤t≤1001 \le t \le 100)—— 表示 Polycarp 购买的灯组数量。

接下来的 tt 行中,每行包含三个整数 rr、gg 和 bb(1≤r,g,b≤1091 \le r, g, b \le 10^9)—— 分别表示该组中红灯、绿灯和蓝灯的数量。

输出格式

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

输出 tt 行——对于每组彩灯,若商店工作人员能用它们制作出花环,则输出“Yes”,否则输出“No”。

输入输出样例

  • 输入#1

    3
    3 3 3
    1 10 2
    2 1 1

    输出#1

    Yes
    No
    Yes

说明/提示

The first two sets are desribed in the statement.

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

前两组在题目描述中已给出。

第三组生成花环“RBRG”,例如。

输入解题思路,AI测评打分。不知道怎么写?

首页