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 ...
随机推荐
- nginx配置详解(转)
Nginx 配置文件详解 user nginx ; #用户 worker_processes 8; #工作进程,根据硬件调整,大于等于cpu核数 error_log logs/nginx_error. ...
- uva-331-枚举-交换的方案数
题意:冒泡排序,最小交换数的前提下有多少用方案把数组变成从小到大的顺序, 注意: 3 2 1 3的下表是1 2的是2 1的是3 交换 3 2,那么第一个交换数是1 最小交换数=逆序数的和 那么,只 ...
- spring data jpa @query的用法
@Query注解的用法(Spring Data JPA) 参考文章:http://www.tuicool.com/articles/jQJBNv . 一个使用@Query注解的简单例子 @Query( ...
- 高负载均衡学习haproxy之安装与配置
https://www.cnblogs.com/ilanni/p/4750081.html
- word自动生成章节标题
一级目录 二级目录 三级标题
- SpringBoot application.yml文件不生效
yml格式对缩进有严格的要求,检查你的yml配置文件是否有不合格的缩进项. 正确的格式如下: server: port: 8881 port前必须有空格, port后的冒号 后面也需要有空格
- Java并发知识(2)
1. 什么是原子操作?在Java Concurrency API中有哪些原子类(atomic classes)? 原子操作是指一个不受其他操作影响的操作任务单元.原子操作是在多线程环境下避免数据不一致 ...
- 不用登陆密码也能进路由器,适用于TP、磊科、腾达
结合wooyun提供的腾达COOKIE漏洞,结合自己的经验,成功进入腾达路由器破解其登陆密码和无线密码. 教程开始: 所用工具:WebCruiser 输入路由网关,出现登陆界面. 选择:COOKIE ...
- 解决:Invalid character found in method name. HTTP method names must be tokens
阿里云上弄了一个tomcat,经常半夜发送崩溃,查看日志发现这个东西,查阅资料发现是Tomcat的header缓冲区大小不够,只需要在server.xml中增加maxHttpHeaderSize字 ...
- 大型运输行业实战_day03_1_基于intellij idea的非maven spring+springMVC+mybatis搭建
1.搭建标准web项目结构 搭建完成后的项目结构如图 1.创建普通web项目(略) 2.在lib中添加jar包 3.在resources中添加spring-config.xml主配置文件 <?x ...