Codeforces Round #461 (Div. 2) A Cloning Toys

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/gtuif/article/details/82284101

A. Cloning Toys

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

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

Copy

6 3

output

Copy

Yes

input

Copy

4 2

output

Copy

No

input

Copy

1000 1001

output

Copy

Yes

Note

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

 题意:一个人可以通过机器进行两种操作,一种是得到copy的玩具和一个original的玩具,另一种是得到两个copy个玩具(前提是要有copy的玩具),初始有一个original的玩具,问能否得到X个copy和Y个original玩具;

思路:先得到Y个original个玩具,再看能否得到X个copy;

下面附上我的代码:

#include<cstdio>
int main()
{
	int x,y;
	scanf("%d %d",&x,&y);
	if(y==0){
		printf("No\n");
	}else if(y==1){
		if(x==0) printf("Yes\n");
		else printf("No\n");
	}else{
		
		int s=y-1;
		int q=x-s;
		if(q<0){
			printf("No\n");
		}else if(q%2==1){
			printf("No\n");
		}else{
			printf("Yes\n");
		}
	}
	
	return 0;
}

猜你喜欢

转载自blog.csdn.net/gtuif/article/details/82284101
今日推荐