CF911C.Three Garlands
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Mishka is decorating the Christmas tree. He has got three garlands, and all of them will be put on the tree. After that Mishka will switch these garlands on.
When a garland is switched on, it periodically changes its state — sometimes it is lit, sometimes not. Formally, if i-th garland is switched on during x-th second, then it is lit only during seconds x, x + k__i, x + 2_k__i_, x + 3_k__i_ and so on.
Mishka wants to switch on the garlands in such a way that during each second after switching the garlands on there would be at least one lit garland. Formally, Mishka wants to choose three integers _x_1, _x_2 and _x_3 (not necessarily distinct) so that he will switch on the first garland during _x_1-th second, the second one — during _x_2-th second, and the third one — during _x_3-th second, respectively, and during each second starting from max(_x_1, _x_2, _x_3) at least one garland will be lit.
Help Mishka by telling him if it is possible to do this!
米什卡正在装饰圣诞树。他有三条彩灯串,全部都要挂到树上,之后他会将这三条彩灯串开启。
当某条彩灯串被开启后,它会周期性地改变其状态——有时亮着,有时熄灭。形式化地说,若第 i 条彩灯串在第 x 秒被开启,则它仅在第 x、x+ki、x+2ki、x+3ki、…… 秒时亮起。
米什卡希望以某种方式开启这三条彩灯串,使得从开启完成的那一刻起,每一秒都至少有一条彩灯串处于点亮状态。形式化地说,米什卡希望选出三个整数 x1、x2 和 x3(它们不一定互不相同),使得他分别在第 x1、x2、x3 秒开启第一条、第二条和第三条彩灯串,并且对每个从 max(x1,x2,x3) 开始的秒数 t,至少有一条彩灯串在该秒亮起。
请帮助米什卡判断:是否存在满足条件的开启方案?
输入格式
The first line contains three integers _k_1, _k_2 and _k_3 (1 ≤ k__i ≤ 1500) — time intervals of the garlands.
第一行包含三个整数 k1、k2 和 k3(1 ≤ ki ≤ 1500)——彩灯串的时间间隔。
输出格式
If Mishka can choose moments of time to switch on the garlands in such a way that each second after switching the garlands on at least one garland will be lit, print YES.
Otherwise, print NO.
如果米什卡能够选择开启花环的时间点,使得开启花环后每一秒至少有一个花环处于点亮状态,则输出 YES。
否则,输出 NO。
输入输出样例
输入#1
2 2 3
输出#1
YES
输入#2
4 2 3
输出#2
NO
说明/提示
In the first example Mishka can choose _x_1 = 1, _x_2 = 2, _x_3 = 1. The first garland will be lit during seconds 1, 3, 5, 7, ..., the second — 2, 4, 6, 8, ..., which already cover all the seconds after the 2-nd one. It doesn't even matter what _x_3 is chosen. Our choice will lead third to be lit during seconds 1, 4, 7, 10, ..., though.
In the second example there is no way to choose such moments of time, there always be some seconds when no garland is lit.
在第一个例子中,Mishka 可以选择 x1=1、x2=2、x3=1。第一串彩灯将在第 1,3,5,7,… 秒点亮,第二串彩灯将在第 2,4,6,8,… 秒点亮,这已经覆盖了从第 2 秒起的所有时刻。此时 x3 取何值都无关紧要。按我们的选择,第三串彩灯将在第 1,4,7,10,… 秒点亮。
在第二个例子中,不存在满足条件的时间点选择方式;总存在某些时刻没有任何一串彩灯被点亮。
输入解题思路,AI测评打分。不知道怎么写?