C. Three Garlands
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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 xx + ki,x + 2kix + 3ki 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 integersx1, x2 and x3 (not necessarily distinct) so that he will switch on the first garland during x1-th second, the second one — during x2-th second, and the third one — during x3-th second, respectively, and during each second starting from max(x1, x2, x3) at least one garland will be lit.

Help Mishka by telling him if it is possible to do this!

Input

The first line contains three integers k1, k2 and k3 (1 ≤ ki ≤ 1500) — time intervals of the garlands.

Output

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.

Examples
input

Copy
2 2 3
output

Copy
YES
input

Copy
4 2 3
output

Copy
NO
Note

In the first example Mishka can choose x1 = 1, x2 = 2, x3 = 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 x3 is chosen. Our choice will lead third to be lit during seconds1, 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.

这题想不出了,于是暴力一发,就A了

暴力出奇迹啊

仔细想,这题确实傻逼

 #include <cstdio>
#include <cstring>
#include <algorithm>
#include <stack>
#include <string>
#include <math.h>
#include <vector>
using namespace std;
const int maxn = 2e5 + ;
const int INF = 0x7fffffff; int main() {
int a[];
while(scanf("%d%d%d", &a[], &a[], &a[]) != EOF) {
sort(a, a + );
if (a[] == ) {
printf("YES\n");
continue;
}
if (a[] == && a[] == ) {
printf("YES\n");
continue;
}
if (a[] == && a[] == && a[] == ) {
printf("YES\n");
continue;
}
if (a[] == && a[] == && a[] == ) {
printf("YES\n");
continue;
}
printf("NO\n");
}
return ;
}

最新文章

  1. input jquery 操作
  2. DDD 领域驱动设计-谈谈 Repository、IUnitOfWork 和 IDbContext 的实践(1)
  3. &lt;mvc:annotation-driven/&gt;与&lt;context:annotation-config/&gt;的区别
  4. @RequestMapping用法详解
  5. java基础3.0:Java常用API
  6. 面向对象原生js幻灯片代淡出效果
  7. POJ 3281
  8. inno setup详细使用教程
  9. 判断浏览器是否支持某个css属性
  10. PHP接口学习
  11. 再起航,我的学习笔记之JavaScript设计模式04
  12. 使用Angular Router导航基础
  13. fromkeys() keys() values() items()
  14. 提取Jar2Exe源代码,JavaAgent监控法
  15. c# 7.0 6.0 新语法
  16. hihoCoder week12 刷油漆
  17. IIS7下配置ASP+ACCESS环境
  18. 函数的类型:函数也是类型 (*)-&gt;*
  19. pycharm安装第三方库失败解决办法
  20. 【Qt】VS2010编译Qt5.3.2 64bit

热门文章

  1. Angular环境配置
  2. Eclipse搭建SpringBoot
  3. day2_作业1(购物车)
  4. 数据分析处理库Pandas——数据透视表
  5. RNN-GRU-LSTM变体详解
  6. 裸机——Nand
  7. [Codeforces958A2]Death Stars (medium)(字符串+hash)
  8. 20145202马超GDB调试汇编堆栈过程分析
  9. Trident整合MongoDB
  10. LDAP操作的两种方案