Codeforces Round #394 (Div. 2) A. Dasha and Stairs
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.
题意:已知有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的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- Codeforces Round #394 (Div. 2) C. Dasha and Password 暴力
C. Dasha and Password 题目连接: http://codeforces.com/contest/761/problem/C Description After overcoming ...
- Codeforces Round #394 (Div. 2) B. Dasha and friends 暴力
B. Dasha and friends 题目连接: http://codeforces.com/contest/761/problem/B Description Running with barr ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- Leetcode 之 Exclusive Time of Functions
636. Exclusive Time of Functions 1.Problem Given the running logs of n functions that are executed i ...
- mongo distinct 指定条件
db.Article.distinct("字段名称",{"Comment.Reply.email" : "xxx"})
- python 自动获取(打印)代码中的变量的名字字串
方法一: import inspectimport re def varname(p): for line in inspect.getframeinfo(inspect.currentframe() ...
- HTTP协议简要介绍
1. 网络基础 TCP/IP 通常使用的网络是在TCP/IP协议簇基础上运作的. HTTP属于它内部的一个子集. TCP/IP分为4个层次, 应用层, 传输层, 网络层, 链路层. (Applicat ...
- 使用哈工大LTP进行句法分析
作者注:本教程旨在对哈工大LTP在github上的LTP4J(LTP的java版本)教程的补充,请结合以下参考网站一起食用. 参考网站: [1]哈工大语言技术平台云官网--LTP使用文档 http:/ ...
- Djngo Rest Framework
目录: 认证和授权 用户访问次数/频率 版本 解析器 序列化 分页 路由系统 视图 渲染器 一. 什么是Restful REST与技术无关,代表的是一种软件架构风格,REST是Representati ...
- 查询前几条记录 top limit
SQL Server 数据库中的Top关键字可实现查询数据库表中的前几条数据,但是需要注意的是,Top关键字只能在SQL Server数据库中可以使用,而在MySQL数据库中就要使用具有同样功能的LI ...
- java实现简单邮件的发送以及常见问题
java实现简单邮件的发送以及常见问题 最近遇到个需求需要实现发送邮件的功能,以前做发送邮件功能都是有邮箱用户名密码,通过用户名密码连接对应的SMTP服务器来实现邮件的发送.但是这次用公司内部的邮箱, ...
- javac是啥
javac是java语言编程编译器.全称java compiler. javac工具读有java语言编写的类和接口的定义,并将它们编译成字节代码的class文件.
- CF335B
/*CF335B 这个题目的n达到50000,但是串只是有小写字母组成,所以如果字符串的长度大于2600,那么 肯定存在,所开始输入就判断如果长度大于2600,那么直接找当个字母输出100个 否则执行 ...