761A Dasha and Stairs
2 seconds
256 megabytes
standard input
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.
In the only line you are given two integers a, b (0 ≤ a, b ≤ 100) — the number of even and odd steps, accordingly.
In the only line print "YES", if the interval of steps described above exists, and "NO" otherwise.
2 3
YES
3 1
NO
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.
#include <iostream>
#include <cmath>
using namespace std; int main()
{
int a, b;
cin >> a >> b;
if(a == && b == )
{
cout << "NO" << endl;
}
else if(abs(a - b) <= )
{
cout << "YES" << endl;
}
else cout << "NO" << endl;
return ;
}
761A Dasha and Stairs的更多相关文章
- 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 ...
- Codeforces761A Dasha and Stairs 2017-02-05 23:28 114人阅读 评论(0) 收藏
A. Dasha and Stairs time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #394 (Div. 2) A. Dasha and Stairs
A. Dasha and Stairs time limit per test:2 seconds memory limit per test:256 megabytes input:standard ...
- 【codeforces 761A】Dasha and Stairs
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- CF761A Dasha and Stairs 题解
Content 给定两个数 \(n,m\),试问是否有区间里面有 \(n\) 个奇数和 \(m\) 个偶数. 数据范围:\(0\leqslant n,m\leqslant 100\). Solutio ...
- CODEFORCES ROUND #761 ANALYSES BY TEAM:RED & BLACK
A. Dasha and Stairs Problems: 一个按照1,2,3……编号的楼梯,给定踩过的编号为奇数奇数和偶数的楼梯数量a和b,问是否可以有区间[l, r]符合奇数编号有a个,偶数编号有 ...
- Codeforces Round #394 (Div. 2) A,B,C,D,E
A. Dasha and Stairs time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #394 (Div. 2)A水 B暴力 C暴力 D二分 E dfs
A. Dasha and Stairs time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Div.2 C. Dasha and Password
C. Dasha and Password time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
随机推荐
- SQL Server 2012 OFFSET/FETCH NEXT分页示例
原文:http://beyondrelational.com/modules/29/presentations/483/scripts/12983/sql-server-2012-server-sid ...
- 开发组件:Supervisor
Supervisor安装与配置(Linux/Unix进程管理工具) https://blog.csdn.net/xyang81/article/details/51555473 https://www ...
- api 1.1构架篇
首先让其自动加载??? 在YiiBase.php里面 改写autoload方法: /** * Class autoload loader. * This method is p ...
- leetcode541
public class Solution { public string ReverseStr(string s, int k) { var len = s.Length; //记录k的倍数 //分 ...
- JS数组对象的方法
concat 返回一个新数组,这个数组是由两个或更多数组组合而成的 array.concat(b,c); join 返回字符串值,其中包括了连接到一起的数组的所有元素,元素由指定分隔符分割开来 arr ...
- DataSnap Server HTTP json格式修改 返回图片
DataSnap Server HTTP json 格式修改 http://127.0.0.1:8080/datasnap/rest/TServerMethods1/EchoString/hello ...
- Tomcat 多项目管理
有时我们会在一个服务下存在多个项目的情况,为了统一管理和服务运行安全考虑,有时候我们需要重新部署一个项目但又不能停掉其它项目,就可以用manager进行管理. Tomcat manager和Root访 ...
- 如何在Oracle中建立表和表空间?
1.建表空间 ORACLE中,表空间是数据管理的基本方法,所有用户的对象要存放在表空间中,也就是用户有空间的使用权,才能创建用户对象.否则是不充许创建对象,因为就是想创建对象,如表,索引等,也没有地方 ...
- nstall neovim on Ubuntu 16.04
https://neovim.io/ To install NeoVim on Ubuntu, run 1 2 3 sudo add-apt-repository ppa:neovim-ppa/sta ...
- sessionStorage和localStorage
html5中的Web Storage包括了两种存储方式:sessionStorage和localStorage. sessionStorage用于本地存储一个会话(session)中的数据,这些数据只 ...