Codeforces761A Dasha and Stairs 2017-02-05 23:28 114人阅读 评论(0) 收藏
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
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <map>
using namespace std;
#define INF 0x3f3f3f3f
#define MAXN 100005 int main()
{
int a,b;
while(~scanf("%d%d",&a,&b))
{
if(a==0&&b==0)
printf("NO\n");
else if(a-b>=2||b-a>=2)
printf("NO\n");
else
printf("YES\n");
} return 0;
}
Codeforces761A Dasha and Stairs 2017-02-05 23:28 114人阅读 评论(0) 收藏的更多相关文章
- 循环队列 分类: c/c++ 2014-10-10 23:28 605人阅读 评论(0) 收藏
利用线性表实现队列,为了有效利用空间,将其设计为循环结构,防止假溢出:牺牲一个存储单元以区分队空.队满. 设front队头,rear队尾,N为顺序表大小 队空:rear==front 队满:(rear ...
- Codeforces761B Dasha and friends 2017-02-05 23:34 162人阅读 评论(0) 收藏
B. Dasha and friends time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- NYOJ-235 zb的生日 AC 分类: NYOJ 2013-12-30 23:10 183人阅读 评论(0) 收藏
DFS算法: #include<stdio.h> #include<math.h> void find(int k,int w); int num[23]={0}; int m ...
- ZOJ2482 IP Address 2017-04-18 23:11 44人阅读 评论(0) 收藏
IP Address Time Limit: 2 Seconds Memory Limit: 65536 KB Suppose you are reading byte streams fr ...
- ZOJ3704 I am Nexus Master! 2017-04-06 23:36 56人阅读 评论(0) 收藏
I am Nexus Master! Time Limit: 2 Seconds Memory Limit: 65536 KB NexusHD.org is a popular PT (Pr ...
- 使用URLConnection获取网页信息的基本流程 分类: H1_ANDROID 2013-10-12 23:51 3646人阅读 评论(0) 收藏
参考自core java v2, chapter3 Networking. 注:URLConnection的子类HttpURLConnection被广泛用于Android网络客户端编程,它与apach ...
- 认识C++中的临时对象temporary object 分类: C/C++ 2015-05-11 23:20 137人阅读 评论(0) 收藏
C++中临时对象又称无名对象.临时对象主要出现在如下场景. 1.建立一个没有命名的非堆(non-heap)对象,也就是无名对象时,会产生临时对象. Integer inte= Integer(5); ...
- Uniform Generator 分类: HDU 2015-06-19 23:26 11人阅读 评论(0) 收藏
Uniform Generator Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) T ...
- hilbert矩阵 分类: 数学 2015-07-31 23:03 2人阅读 评论(0) 收藏
希尔伯特矩阵 希尔伯特矩阵是一种数学变换矩阵 Hilbert matrix,矩阵的一种,其元素A(i,j)=1/(i+j-1),i,j分别为其行标和列标. 即: [1,1/2,1/3,--,1/n] ...
随机推荐
- codevs 计算器的改良
#include<iostream> #include<cctype> #include<vector> #include<cstdio> using ...
- Android 查看Android版本的方法
1.通过源码查看 Android 版本 路径:build/core/version_defaults.mk PLATFORM_VERSION := 2.通过编译时终端输出查看 ============ ...
- mac sublime切换编辑语言的方法(添加其他版本的python)
在sublime中指定python版本,操作如下: Sublime——tools——build system——new build system 把文件中的内容替换为 { "cmd" ...
- 根据给定文件编写Makefile文件 两种方法编译
实例一 1.分析源文件代码依赖关系 mian.c #include "test1.h" #include "test2.h" #include <stdi ...
- 学习笔记之Python 3 教程
Python 3 教程 http://www.runoob.com/python3/python3-tutorial.html Python的3.0版本,常被称为Python 3000,或简称Py3k ...
- 跟我学算法-svm支持向量机算法推导
Svm算法又称为支持向量机,是一种有监督的学习分类算法,目的是为了找到两个支持点,用来使得平面到达这两个支持点的距离最近. 通俗的说:找到一条直线,使得离该线最近的点与该线的距离最远. 我使用手写进行 ...
- Linux Tomcat8 访问管理页面 403 Access Denied
http://blog.csdn.net/u012167045/article/details/61624226 1:修改conf/tomcat-users.xml配置文件 2:vi /usr/loc ...
- Centos7手动编译安装Python3
Python3的安装方式非常的简单,首先去到Python下载目录下载想要的Python包,这里我选择了3.6.5版本 $ wget https://www.python.org/ftp/python/ ...
- What I'm Researching
[What I'm Researching] 1.C++11 2.NLP 3.android dev 4.warm up 5.PageRank
- Connection Lifetime
Connection Lifetime作用(数据库群集) 2010-11-12 14:17:01| 分类: sql server 2005 | 标签: |字号大http://xiangzhang ...