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 ...
随机推荐
- (链接)IDEA 2018 激活 IDEA 2018.3激活教程 最新的(三种)—2018.11.26亲测
破解不成功的请注意时效性,写于2019/2/8,以下第一种激活方法亲测可用, 不过有时候破解成功了可能过几天突然就打不开了,双击无反应的说,这时候再按顺序 操作一遍就是了: 1)把idea64.exe ...
- ACM_____不再爱你……
不再爱你…… 时间限制:1000 ms | 内存限制:65535 KB 难度:3 描述 现在有一个圆柱形水杯,里面装满了水,在它的底部有一个小洞,通过一些简单的物理知识我们可以知道: 1.由于重力 ...
- VTK+MFC 系列教程 非常强大
虽然QT才是王道!MFC的懂一些也是好的. 原文链接:http://blog.csdn.net/www_doling_net/article/details/8939115 之前介绍了基于VTK的单文 ...
- Python笔记16-------类
1.类的定义 (1)#括号中要加入父类,如果没有则默认为object,万类之源 class 类名(父类): '类的文档字符串' 类体代码 若类什么都不做,则类只作为命名空间,仅作为一个容器. (2)类 ...
- Node笔记(1)
Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境. 进程 1.process.argv 用于获取当前进程信息 0--node.exe的目录1--js文件的目录2 ...
- Java多线程中Sleep与Wait的区别
Java中的多线程是一种抢占式的机制 而不是分时机制.抢占式机制指的是有多个线程处于可运行状态,但是只有一个线程在运行. 共同点: 1. 他们都是在多线程的环境下,都可以在程序的调用处阻塞指定的毫秒数 ...
- 1、Ansible初识简要介绍及安装
1.Ansible简介 1.1 Ansible介绍 Ansible 是一个简单的自动化运维管理工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fab ...
- 谈谈python里面关于任务队列
谈谈python里面关于任务队列 为什么要做任务队列 要回答这个问题我们首先看看在流水线上的案列,如果人的速度很慢,机器的速度比人的速度快很多,就会造成,机器生产的东西没有及时处理,越积越多,造成阻塞 ...
- MYSQL存储过程初步认知
存储过程(Stored Procedure): 一组可编程的函数,是为了完成特定功能的SQL语句集,经编译创建并保存在数据库中,用户可通过指定存储过程的名字并给定参数(需要时)来调用执行. 优点:将重 ...
- Spring MVC 的概念1
---恢复内容开始--- SpringMVC是一个采用模型----视图------控制器(MVC)的WEb框架建立在中央前端控制器的 Servlet(DispatcherServlet),他负责发送每 ...