A. Dasha and Stairs
time limit per test:2 seconds
memory limit per test:256 megabytes
input:standard input
output:standard 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 ab (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.

 

题意:已知有a个偶数b个奇数,判断这些数能不能组成连续正整数数列。

//没有考虑a==b和a=0并且b=0的时候
#include <iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int a,b;
int main()
{
scanf("%d%d",&a,&b);
if (abs(a-b)== || a==b && a!= && b!=) printf("YES\n");
else printf("NO\n");
return ;
}

Codeforces Round #394 (Div. 2) A. Dasha and Stairs的更多相关文章

  1. Codeforces Round #394 (Div. 2) A. Dasha and Stairs 水题

    A. Dasha and Stairs 题目连接: http://codeforces.com/contest/761/problem/A Description On her way to prog ...

  2. Codeforces Round #394 (Div. 2) E. Dasha and Puzzle(分形)

    E. Dasha and Puzzle time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  3. Codeforces Round #394 (Div. 2) E. Dasha and Puzzle 构造

    E. Dasha and Puzzle 题目连接: http://codeforces.com/contest/761/problem/E Description Dasha decided to h ...

  4. Codeforces Round #394 (Div. 2) D. Dasha and Very Difficult Problem 贪心

    D. Dasha and Very Difficult Problem 题目连接: http://codeforces.com/contest/761/problem/D Description Da ...

  5. Codeforces Round #394 (Div. 2) C. Dasha and Password 暴力

    C. Dasha and Password 题目连接: http://codeforces.com/contest/761/problem/C Description After overcoming ...

  6. Codeforces Round #394 (Div. 2) B. Dasha and friends 暴力

    B. Dasha and friends 题目连接: http://codeforces.com/contest/761/problem/B Description Running with barr ...

  7. Codeforces Round #394 (Div. 2) D. Dasha and Very Difficult Problem —— 贪心

    题目链接:http://codeforces.com/contest/761/problem/D D. Dasha and Very Difficult Problem time limit per ...

  8. Codeforces Round #394 (Div. 2) C. Dasha and Password —— 枚举

    题目链接:http://codeforces.com/problemset/problem/761/C C. Dasha and Password time limit per test 2 seco ...

  9. Codeforces Round #394 (Div. 2) B. Dasha and friends —— 暴力 or 最小表示法

    题目链接:http://codeforces.com/contest/761/problem/B B. Dasha and friends time limit per test 2 seconds ...

随机推荐

  1. HDU1712:ACboy needs your help(分组背包)

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1712 解释看这里:http://www.cnblogs.com/zhangmingcheng/p/3940 ...

  2. 使用npm构建前端项目基本流程

    现在各种前端框架, 库文件基本都托管到npm上, 我们平常下载到别人的项目文件, 也基本是用npm 构建的, 不了解点node和npm那是寸步难行. 下面介绍的代码示例不敢说是最佳实践, 但都是我亲自 ...

  3. PHP 权限管理

    login页面 <form action="loginchuli.php" method="post"> <div>用户名:<in ...

  4. docker安装部署PHP nginx

    sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=htt ...

  5. c++中小项堆声明和使用

    c++默认是大顶堆,小顶堆有两种声明方法: 1.对于基本类型直接用 priority_queue<int, vector<int>, greater<int> >p ...

  6. C++中int转为char 以及int 转为string和string 转int和字符串的split

    1.对于int 转为char 直接上代码: 正确做法: void toChar(int b) { char u; ]; _itoa( b, buffer, ); //正确解法一 u = buffer[ ...

  7. MySQL性能调优思路

    1.MySQL性能调优思路 如果一台服务器出现长时间负载过高 /周期性负载过大,或偶尔卡住如何来处理? 是周期性的变化还是偶尔问题?是服务器整体性能的问题, 还是某单条语句的问题? 具体到单条语句, ...

  8. 正式学习React(四) ----Redux源码分析

    今天看了下Redux的源码,竟然出奇的简单,好吧.简单翻译做下笔记: 喜欢的同学自己可以去github上看:点这里 createStore.js import isPlainObject from ' ...

  9. 解析Linux系统的平均负载概念

    一.什么是系统平均负载(Load average)? 在Linux系统中,uptime.w.top等命令都会有系统平均负载load average的输出,那么什么是系统平均负载呢?系统平均负载被定义为 ...

  10. AI理论学习笔记(一):深度学习的前世今生

    AI理论学习笔记(一):深度学习的前世今生 大家还记得以深度学习技术为基础的电脑程序AlphaGo吗?这是人类历史中在某种意义的第一次机器打败人类的例子,其最大的魅力就是深度学习(Deep Learn ...