time limit per test2 seconds

memory limit per test256 megabytes

inputstandard input

outputstandard output

On her way to programming school tiger Dasha faced her first test — a huge staircase!

The steps were numbered from one to infinity. As we know, tigers are very fond of all striped things, it is possible that it has something to do with their color. So on some interval of her way she calculated two values — the number of steps with even and odd numbers.

You need to check whether there is an interval of steps from the l-th to the r-th (1 ≤ l ≤ r), for which values that Dasha has found are correct.

Input

In the only line you are given two integers a, b (0 ≤ a, b ≤ 100) — the number of even and odd steps, accordingly.

Output

In the only line print “YES”, if the interval of steps described above exists, and “NO” otherwise.

Examples

input

2 3

output

YES

input

3 1

output

NO

Note

In the first example one of suitable intervals is from 1 to 5. The interval contains two even steps — 2 and 4, and three odd: 1, 3 and 5.

【题目链接】:http://codeforces.com/contest/761/problem/A

【题解】



一段区间里面,偶数和奇数的个数的差的绝对值不会超过1;

但是有个Hack点0 0;

一段区间里面不可能既没有奇数也没有偶数;



【完整代码】

#include <bits/stdc++.h>
using namespace std; int a,b; int main()
{
cin >> a >> b;
int temp = abs(a-b);
if (temp<=1)
{
if (a==0 && b==0)
puts("NO");
else
puts("YES");
}
else
puts("NO");
return 0;
}

【codeforces 761A】Dasha and Stairs的更多相关文章

  1. 【codeforces 761C】Dasha and Password(动态规划做法)

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  2. 【codeforces 761C】Dasha and Password(贪心+枚举做法)

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  3. 【codeforces 761B】Dasha and friends

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  4. 【codeforces 761D】Dasha and Very Difficult Problem

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  5. 【codeforces 761E】Dasha and Puzzle

    [题目链接]:http://codeforces.com/contest/761/problem/E [题意] 给你一棵树,让你在平面上选定n个坐标; 使得这棵树的连接关系以二维坐标的形式展现出来; ...

  6. 【codeforces 415D】Mashmokh and ACM(普通dp)

    [codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...

  7. 【codeforces 707E】Garlands

    [题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...

  8. 【codeforces 707C】Pythagorean Triples

    [题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...

  9. 【codeforces 709D】Recover the String

    [题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...

随机推荐

  1. typescript+react+antd基础环境搭建

    typescript+react+antd基础环境搭建(包含样式定制) tsconfig.json 配置 // 具体配置可以看上面的链接 这里module moduleResolution的配置都会影 ...

  2. 基于spring-boot的测试桩设计--几种常见的controller

    第一种:通过@RequestBody,直接将请求体映射到对象 //@RequestBody @RequestMapping(value = "addUser", method = ...

  3. Codeforces 436C

    题目链接 C. Dungeons and Candies time limit per test 2 seconds memory limit per test 256 megabytes input ...

  4. 编程语言分类及python所属类型

    编程语言分类及python所属类型 编程语言主要从以下几个角度为进行分类:编译型和解释型.静态语言和动态语言.强类型定义语言和弱类型定义语言. 编译和解释的区别是什么? 编译器是把源程序的每一条语句都 ...

  5. 【JZOJ4898】【NOIP2016提高A组集训第17场11.16】人生的价值

    题目描述 NiroBC终于找到了人生的意义,可是她已经老了,在新世界,没有人认识她,她孤独地在病榻上回顾着自己平凡的一生,老泪纵横.NiroBC多么渴望再多活一会儿啊! 突然一个戴着黑色方框眼镜,方脸 ...

  6. 【OI】倍增求LCA

    ╭(′▽`)╯ 总之,我们都知道lca是啥,不需要任何基础也能想出来怎么用最暴力的方法求LCA,也就是深度深的点先跳到深度浅的点的同一深度,然后一起向上一步步跳.这样显然太慢了! 所以我们要用倍增,倍 ...

  7. Ceph 之 Background on http frontends

    Background on http frontends -civetweb frontend --thread per connection, requires a lot of threads - ...

  8. java 使用poi导出Excel,设置单元格保护不可编辑

    //sheet表加密:等效excel的审阅菜单下的保护工作表 sheet.protectSheet(new String("333"));//333是密码 更多设置请参考:http ...

  9. day39-Spring 11-Spring的AOP:基于AspectJ的XML配置方式

    package cn.itcast.spring3.demo2; import org.aspectj.lang.ProceedingJoinPoint; /** * 切面类 * @author zh ...

  10. 序列化类型为“System.Data.Entity.DynamicProxies..."对象时检测到循环引用

    这是因为EF外键引起的序列化问题. 解决方案: context.Configuration.ProxyCreationEnabled = false; 这里我用的是一个基类控制器用于被继承 返回EF实 ...