A. Cloning Toys

time limit per test 1 second

memory limit per test 256 megabytes

Problem Description

Imp likes his plush toy a lot.



Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, and if he applies the machine to a copied toy, he gets two additional copies.

Initially, Imp has only one original toy. He wants to know if it is possible to use machine to get exactly x copied toys and y original toys? He can’t throw toys away, and he can’t apply the machine to a copy if he doesn’t currently have any copies.

Input

The only line contains two integers x and y (0 ≤ x, y ≤ 109) — the number of copies and the number of original toys Imp wants to get (including the initial one).

Output

Print “Yes”, if the desired configuration is possible, and “No” otherwise.

You can print each letter in arbitrary case (upper or lower).

Examples

Input

6 3

Output

Yes

Input

4 2

Output

No

Input

1000 1001

Output

Yes

Note

In the first example, Imp has to apply the machine twice to original toys and then twice to copies.


解题心得:

  1. 比赛的时候差点被这个题的题意给绕进去,看了好久,其实这个题的意思是,

    • 你将一个原版的物品放入copy机,可以多得到一个原版的物品,多得到一个复制的物品。
    • 如果把复制的物品放入copy机,可以多得到两个复制的物品。
  2. 判定是否可以出现x个复制物品,y个原版的物品就很简单了。x-y+1必须是一个偶数,x-y+1必须大于等于零,y必须大于1(不能丢弃),y等于1的时候x必须等于0。判断不完全可能被hack。

#include <bits/stdc++.h>
using namespace std;
const int maxn = 10;
int main(){
int a,b;
scanf("%d%d",&a,&b);
if((b == 1 && a != 0) || b == 0){
printf("No\n");
return 0;
}
int c = a-b+1;
if(c%2 || c < 0)
printf("No\n");
else
printf("Yes\n");
return 0;
}

Codeforces Round #461 (Div. 2) A. Cloning Toys的更多相关文章

  1. CF922 CodeForces Round #461(Div.2)

    CF922 CodeForces Round #461(Div.2) 这场比赛很晚呀 果断滚去睡了 现在来做一下 A CF922 A 翻译: 一开始有一个初始版本的玩具 每次有两种操作: 放一个初始版 ...

  2. Codeforces Round #461 (Div. 2)

    A - Cloning Toys /* 题目大意:给出两种机器,一种能将一种原件copy出额外一种原件和一个附件, 另一种可以把一种附件copy出额外两种附件,给你一个原件, 问能否恰好变出题目要求数 ...

  3. Codeforces Round #461 (Div. 2) B C D

    题目链接:http://codeforces.com/contest/922 B. Magic Forest time limit per test 1 second memory limit per ...

  4. Codeforces Round #461 (Div. 2) D. Robot Vacuum Cleaner

    D. Robot Vacuum Cleaner time limit per test 1 second memory limit per test 256 megabytes Problem Des ...

  5. Codeforces Round #461 (Div. 2) C. Cave Painting

    C. Cave Painting time limit per test 1 second memory limit per test 256 megabytes Problem Descriptio ...

  6. Codeforces Round #461 (Div. 2) B. Magic Forest

    B. Magic Forest time limit per test 1 second memory limit per test 256 megabytes Problem Description ...

  7. Codeforces Round #461 (Div. 2)B-Magic Forest+位运算或优雅的暴力

    Magic Forest 题意:就是在1 ~ n中找三个值,满足三角形的要求,同时三个数的异或运算还要为0: , where  denotes the bitwise xor of integers  ...

  8. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  9. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

随机推荐

  1. SpringBoot | 番外:使用小技巧合集

    前言 最近工作比较忙,事情也比较多.加班回到家都十点多了,洗个澡就想睡觉了.所以为了不断更太多天,偷懒写个小技巧合集吧.之后有时间都会进行文章更新的.原创不易,码字不易,还希望大家多多支持!话不多说, ...

  2. PHPGGC学习----实践

    本文首发于先知:https://xz.aliyun.com/t/5450 PHPGGC学习----理论部分对PHPGGC工具的使用方法有了一个基本的了解,接下来需要利用实践环境进行一个实践操作,巩固一 ...

  3. Oracle单列函数

    --字符函数--1.ASCII 返回与指定的字符对应的十进制数;select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space fr ...

  4. 【前端】Chrome DevTools 笔记

    1. 查看网络耗时 timeline 生命周期按照以下类别显示花费的时间: Queuing Stalled 如果适用:DNS lookup.initial connection.SSL handsha ...

  5. 如何使用VS将项目生成一个安装包?

    VS2010项目的部署与安装winform程序,我想进行安装.1.在解决方案中 ——点击右键——添加 2.然后选择 安装和部署 ——安装向导 可以更改名称 3.点击 下一步 4.然后选择上那3个 5. ...

  6. 红象云腾CRH 一键部署大数据平台

    平台: arm 类型: ARM 模板 软件包: azkaban hadoop 2.6 hbase hive kafka spark zeppelin azkaban basic software bi ...

  7. mstsc远程桌面全频或自定义窗口

    近期发现自己的mstsc突然窗口变小,总是要繁琐的拖来拖去,现终于解决了,拿来分享一二! 参数一:mstsc /f   以全屏模式显示(操作一次,后面无需在设置,具体何原因要问微软了,可能是机器的分辨 ...

  8. 您H1B身份的申请或H1B延期的申请提交对地方了吗?

    由于H1B配额的短缺,任何关于移民局对H1B申请的改动对马上要申请H1B的外国学生或专业人士来说都很重要.美国移民局在2007年3月5号发布了关于更改接收H1B身份申请或H1B延期申请的新政策. 申请 ...

  9. mybatis-分页和缓存

    1.分页 1.1在dao接口中配置分页参数: package com.java1234.mappers; import java.util.List;import java.util.Map; imp ...

  10. 写在Github被微软收购之际 - Github的那些另类用法

    这几天朋友圈被微软75亿美元收购Github的新闻刷屏了.Jerry也来贡献一篇和Github相关的文章. 这篇文章包含了Jerry平时对于Github的一些另类用法.目录如下: 1. 部署HTML应 ...