CF922A Cloning Toys
1 second
256 megabytes
standard input
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.
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).
Print "Yes", if the desired configuration is possible, and "No" otherwise.
You can print each letter in arbitrary case (upper or lower).
6 3
Yes
4 2
No
1000 1001
Yes
In the first example, Imp has to apply the machine twice to original toys and then twice to copies.
有两种玩具,这里假设成A、B两种玩具,A玩具可以再产生一个A玩具和一个B玩具,B玩具可以再产生两个B玩具。现在我们有一个A玩具,问最后是否能得到X个B玩具,Y个A玩具。能得到输出Yes,不能得到输出No。
#include<map>
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define maxn 100010
#define debug(a) cout << #a << " " << a << endl
using namespace std;
typedef long long ll;
int main() {
int n,m;
while( cin >> n >> m ) {
if( n == && m == ) {
cout << "Yes" << endl;
continue;
}
if( n == || m == || m == ) {
cout << "No" << endl;
continue;
}
if( ( n - m + ) % == && ( n - m + ) >= ) {
cout << "Yes" << endl; //注意负的偶数余2也等于0,这里要特判下,因为没有考虑到这种情况WA两次。。。
} else {
cout << "No" << endl;
}
}
return ;
}
CF922A Cloning Toys的更多相关文章
- Codeforces Round #461 (Div. 2) A. Cloning Toys
A. Cloning Toys time limit per test 1 second memory limit per test 256 megabytes Problem Description ...
- codeforces 461div.2
A Cloning Toys standard input/output 1 s, 256 MB B Magic Forest standard input/output 1 s, 256 M ...
- Codeforces Round #461 (Div. 2)
A - Cloning Toys /* 题目大意:给出两种机器,一种能将一种原件copy出额外一种原件和一个附件, 另一种可以把一种附件copy出额外两种附件,给你一个原件, 问能否恰好变出题目要求数 ...
- [Codeforces Round #461 (Div2)] 题解
[比赛链接] http://codeforces.com/contest/922 [题解] Problem A. Cloning Toys [算法] 当y = 0 , 不可以 当 ...
- When cloning on with git bash on Windows, getting Fatal: UriFormatException encountered
I am using git bash $ git --version git version .windows. on Windows 7. When I clone a repo, I see: ...
- 对C#对象的Shallow、Deep Cloning认识【转】
好像园内比较多博客对 Shallow.Deep Cloning的翻译是深拷贝.浅拷贝,当时我懵了,这个叫法怎么怪怪的. 就好像看军情观察室,台湾评论员,导弹叫飞弹. 至于它们的区别,一张图就可以解释. ...
- 【POJ】2318 TOYS(计算几何基础+暴力)
http://poj.org/problem?id=2318 第一次完全是$O(n^2)$的暴力为什么被卡了-QAQ(一定是常数太大了...) 后来排序了下点然后单调搞了搞..(然而还是可以随便造出让 ...
- Workspace Cloning / Sharing in Jenkins
http://lwandersonmusings.blogspot.com/2011/06/workspace-cloning-sharing-in-hudson.html What's insi ...
- poj 2318 TOYS (二分+叉积)
http://poj.org/problem?id=2318 TOYS Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 101 ...
随机推荐
- 补充Java面试记录
补充Java面试记录 背景:这两天面试遇到的部分问题都分散在了前面两篇文摘中,这里再做一些其他的记录,以备不时之需! 一.谈谈你对SpringBoot的理解? SpringBoot简介:SpringB ...
- [Short-Circuit Constraint Violation]警告解决办法
今天用Altium Designer16画PCB时候遇到一个问题,进行DRC检测,警告如下: [Short-Circuit Constraint Violation] GrayscaleSensor1 ...
- .Net异步编程详解入门
前言 今天周五,早上起床晚了.赶着挤公交上班.但是目前眼前有这么几件事情.刷牙洗脸.泡牛奶.煎蛋.在同步编程眼中.先刷牙洗脸,然后烧水泡牛奶.再煎蛋,最后喝牛奶吃蛋.毫无疑问,在时间紧促的当下.它完了 ...
- java并发编程(十九)----(JUC集合)总体框架介绍
本节我们将继续学习JUC包中的集合类,我们知道jdk中本身自带了一套非线程安全的集合类,我们先温习一下java集合包里面的集合类,然后系统的看一下JUC包里面的集合类到底有什么不同. java集合类 ...
- 28岁,转行学 IT 靠谱吗?
前几天在知乎上,刷到这么一个问题 鉴于有不少人看了我的blog给我私信一些职业规划相关的问题,讨论很多的就是担心自己年龄是否还适合转行. 于是决定静心下来码了一篇回答, 同时搬到博客园来供大家消遣.. ...
- 虚拟机安装CentOS的简短教程
说明: 为什么要学Linux?因为现在互联网产品普遍使用Linux作为服务器系统. 测试工程师要学Linux吗?要,因为你会需要跟服务器打交道. 什么情况下测试工程师会跟服务器打交道?你可能要去部署测 ...
- Flink 源码解析 —— Standalone session 模式启动流程
Standalone session 模式启动流程 https://t.zsxq.com/EemAEIi 博客 1.Flink 从0到1学习 -- Apache Flink 介绍 2.Flink 从0 ...
- C#表达式树浅析
一.前言 在我们日常开发中Lamba 表达式经常会使用,如List.Where(n=>Name="abc") 使用起来非常的方便,代码也很简洁,总之一个字就是“爽”.在之前我 ...
- .NET Core C#中级篇2-5 常见实用类
.NETCore CSharp 中级篇2-5 本节内容为常见实用类和方法的使用 String.Format string.format方法是一个字符串格式化类,它里面的一些写法是对字符串进行指定格式的 ...
- 图解Java数据结构之队列
本篇文章,将对队列进行一个深入的解析. 使用场景 队列在日常生活中十分常见,例如:银行排队办理业务.食堂排队打饭等等,这些都是队列的应用.那么队列有什么特点呢? 我们知道排队的原则就是先来后到,排在前 ...