CodeForces--606A --Magic Spheres(模拟水题)
Time Limit: 2000MS | Memory Limit: 262144KB | 64bit IO Format: %I64d & %I64u |
Description
Carl is a beginner magician. He has a blue,
b violet and c orange magic spheres. In one move he can transform two spheres
of the same color into one sphere of any other color. To make a spell that has never been seen before, he needs at least
x blue, y violet and
z orange spheres. Can he get them (possible, in multiple actions)?
Input
The first line of the input contains three integers a,
b and c (0 ≤ a, b, c ≤ 1 000 000) — the number of blue, violet and orange spheres that are in the magician's disposal.
The second line of the input contains three integers, x,
y and z (0 ≤ x, y, z ≤ 1 000 000) — the number of blue, violet and orange spheres that he needs to get.
Output
If the wizard is able to obtain the required numbers of spheres, print "Yes". Otherwise, print "No".
Sample Input
4 4 0
2 1 2
Yes
5 6 1
2 7 2
No
3 3 3
2 2 2
Yes
Sample Output
Hint
In the first sample the wizard has 4 blue and
4 violet spheres. In his first action he can turn two blue spheres into one violet one. After that he will have
2 blue and 5 violet spheres. Then he turns
4 violet spheres into 2 orange spheres and he ends up with
2 blue, 1 violet and
2 orange spheres, which is exactly what he needs.
Source
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int a,b,c,x,y,z;
long long ans,pre;
int main()
{
while(scanf("%d%d%d%d%d%d",&a,&b,&c,&x,&y,&z)!=EOF)
{
ans=pre=0;
int p,q,r;
p=q=r=0;
if(a-x>=0) p=0,pre+=(a-x)/2;
else p=a-x;
if(b-y>=0) q=0,pre+=(b-y)/2;
else q=b-y;
if(c-z>=0) r=0,pre+=(c-z)/2;
else r=c-z;
// printf("%d\n",pre);
// printf("%d %d %d\n",p,q,r);
if(pre+p+q+r>=0) printf("Yes\n");
else printf("No\n");
}
return 0;
}
CodeForces--606A --Magic Spheres(模拟水题)的更多相关文章
- CodeForces 606A Magic Spheres
水题 /* *********************************************** Author :Zhou Zhentao Email :774388357@qq.com C ...
- Codeforces 631A Interview【模拟水题】
题意: 模拟模拟~~ 代码: #include<iostream> using namespace std; const int maxn = 1005; int a[maxn], b[m ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- POJ 2014:Flow Layout 模拟水题
Flow Layout Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3091 Accepted: 2148 Descr ...
- 【CodeForces 606A】A -特别水的题1-Magic Spheres
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/A Description Carl is a beginne ...
- Codeforces Round #335 (Div. 2) A. Magic Spheres 模拟
A. Magic Spheres Carl is a beginner magician. He has a blue, b violet and c orange magic spheres. ...
- CodeForces 489B BerSU Ball (水题 双指针)
B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- codeforces 577B B. Modulo Sum(水题)
题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树
A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...
随机推荐
- Scrapy日志等级以及请求传参
日志等级 请求传参 提高scrapy的爬取效率 日志等级 - 日志信息: 使用命令:scrapy crawl 爬虫文件 运行程序时,在终端输出的就是日志信息: - 日志信息的种类: - ERROR ...
- QlikSense系列(4)——QlikSense管理
QlikSense管理主要通过QMC界面,在安装成功后,首先需要导入用户,QlikSense本身不能创建和验证用户,只能借助第三方系统, 笔者只使用过Windows账户和AD域用户: 1.Window ...
- 2017-4-18 关于小组APP
演讲: 各位合作伙伴:我们的产品:图书鉴赏是为了解决18岁到28岁青年的痛苦,他们需要更好的图书推荐,更多的好书,但是现有的方案并没有能很好的解决这些需求,我们有独特的办法制作一个图书鉴赏的APP,它 ...
- 【Oracle】使用logmnr挖掘日志
使用Logmnr挖掘日志的详细步骤如下: 1. 查看日志状态及位置 col member for a45 select group#,status from v$log; select group#, ...
- ndk编译curl以及使用
百度搜ndk curl,大多都是转发的同一篇文章,文章中提供的lcur_config.h,不一定适合你的curl版本. 后来找到http://download.csdn.net/download/cs ...
- Java 方法的应用
Java方法可以理解为C#中的函数,都是把复杂的问题简单化,按模块,按功能区分,分别完成各个部分在调用这些方法完成整个功能. 方法的综合练习,猜数字的实现: 代码要求: 生成不重复的4位数字(只有1- ...
- [SOA]REST与SOA两种架构的异同比较
REST的特性 它基于HTTP协议,是一种明确构建在客户端/服务端体系结构上的一种风格.特征如下: 1.网络上的资源都被抽象为资源,这些资源都具有唯一的统一资源标识符(URI:Uniform Reso ...
- 优动漫PAINT(clip studio paint)怎么画一幅水墨竹子图
今天小编分享使用优动漫PAINT绘制一个水墨竹子教程,绘画的过程中我只用到了两个笔刷,即钢笔模式下的“美术字”和“效果线专用”,并且全程鼠标绘制哦,所以生疏的笔触效果大家见谅,没有数位板的小伙伴不妨试 ...
- APICloud开发小技巧(一)
apicloud开发文档中,前端开发框架指的就是,类似jq\js的语法: https://docs.apicloud.com/Front-end-Framework/framework-dev-gui ...
- JS 20180416课时训练
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...