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 ...
 
随机推荐
- OOM和JVM配置优化
			
OOM这个缩写就是Java程序开发过程中让人最头痛的问题:Out of Memory.在很多开发人员的开发过程中,或多或少的都会遇到这类问题,这类问题定位比较困难,往往需要根据经验来判断可能出现问题的 ...
 - Zabbix利用Windows性能监视器监控各项资源指标
			
zabbix自带的windows监控模板并没有监控windows cpu使用率的监控 在cmd命令输入perfmon 打开后默认就一项CPU占用的监控,下面以添加硬盘空闲时间做示例 1:监控图形上面右 ...
 - JavaFX Metro UI 和 开发库
			
目录 [隐藏] 1 Metro UI For JavaFX! 1.1 例子 1.2 Switch 1.3 Button 1.4 案例: 2 ConsrolsFX 3 Notification 的使用 ...
 - Java | Map排序,工具类改进
			
package util; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; ...
 - mysql新建用户及授权
			
添加用户 CREATE USER 'username'@'localhost' IDENTIFIED BY 'password'; -- username : 自定义用户名 -- localhost ...
 - 解读 PHP 的 P++提案
			
解读 PHP 的 P++提案 周末看到一篇文章说 PHP 创始人提议将 PHP 拉出新分支,创建 P++ 语言.随后阅读了一下 Zeev Suraski 发起的这个邮件列表,大致了解了一下,这里做个解 ...
 - 帝国CMS(EmpireCMS) v7.5 代码注入分析(CVE-2018-19462)
			
帝国CMS(EmpireCMS) v7.5 代码注入分析(CVE-2018-19462) 一.漏洞描述 EmpireCMS7.5及之前版本中的admindbDoSql.php文件存在代码注入漏洞.该漏 ...
 - 深入理解Nginx及使用Nginx实现负载均衡
			
前言: 最近在部署项目时要求实现负载均衡,有趣的是发现网上一搜全部都是以下类似的配置文件 upstream localhost{ server 127.0.0.1:8080 weight=1; ser ...
 - Python模块之snmp-cmds,easysnmp
			
一.简介 snmp-cmds模块通过SNMP与目标设备进行通信,此模块适用于windows,此模块是基于系统已安装了net-snmp环境easysnmp模块通过SNMP与谬表设备进行通信,此模块用于l ...
 - Nginx总结(一)Linux下如何安装Nginx
			
以前写过一些Nginx的文章,但都是用到什么说什么,没有一个完整系统的总结.趁最近有时间,打算将Nginx相关的内容重新整理一下.nginx系列文章地址如下:https://www.cnblogs.c ...