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. How to Install VMware Tools on RHEL 7/CentOS 7

    The original address Mware Tools is one of important components for virtual machine (VM) in order ge ...

  2. window.open 打开Excel或者Word 无权限问题

    场景:后端C# ashx 前端:js js在对ashx返回结果进行window.open(url)  url为后端保存excel的一个地址 提示:无操作权限 url:为后端处理后,服务器上一个完整的路 ...

  3. ajax post方式表单提交的注意事项。

    当我们创建一个异步对象XMLHttpRequest同时post方式向后台传输数据的时候. 我们要设置异步对象的xhr.setRequestHeader成员的值为 XMLHttpRequest.setR ...

  4. Java图形界面开发—列出指定目录

    代码如下: package com.packageTemp; import javax.swing.*; import java.awt.*; import java.awt.event.*; imp ...

  5. Winform 读取 指定\另一个\其他\任意 配置文件

    ExeConfigurationFileMap map = new ExeConfigurationFileMap();            map.ExeConfigFilename = @&qu ...

  6. web安全防御之RASP技术

    作者:      我是小三 博客:      http://www.cnblogs.com/2014asm/ 由于时间和水平有限,本文会存在诸多不足,希望得到您的及时反馈与指正,多谢! 0x00:we ...

  7. linux日常1-踢出用户

    踢掉自己不用的终端 1.查看系统在线用户 w 2.查看哪个属于此时自己的终端(我开了两个连接) who am i 3.pkill掉自己不适用的终端 pkill -kill -t pts/1 注意: 如 ...

  8. linux性能测试脚本

    http://linux-bench.com/ What is Linux-Bench? Linux-Bench is a simple script that provides a basic le ...

  9. Android商城开发系列(十)—— 首页活动广告布局实现

    在上一篇博客当中,我们讲了频道布局的实现,接下来我们讲解一下活动广告布局的实现,效果如下图: 这个是用viewpager去实现的,新建一个act_item.xml,代码如下所示: <?xml v ...

  10. wordpress中一些喜欢的主题

    Personal lite Bhari Blogi