Time Limit: 2000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u

Submit
Status

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

Input
4 4 0
2 1 2
Output
Yes
Input
5 6 1
2 7 2
Output
No
Input
3 3 3
2 2 2
Output
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


现在给你a,b,c个不同颜色的球,神魔颜色我也不知道,两个相同颜色的可以得到一个任意颜色的,问现在是否可以得到x,y,z,个三种颜色的球
#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(模拟水题)的更多相关文章

  1. CodeForces 606A Magic Spheres

    水题 /* *********************************************** Author :Zhou Zhentao Email :774388357@qq.com C ...

  2. Codeforces 631A Interview【模拟水题】

    题意: 模拟模拟~~ 代码: #include<iostream> using namespace std; const int maxn = 1005; int a[maxn], b[m ...

  3. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  4. POJ 2014:Flow Layout 模拟水题

    Flow Layout Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3091   Accepted: 2148 Descr ...

  5. 【CodeForces 606A】A -特别水的题1-Magic Spheres

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/A Description Carl is a beginne ...

  6. 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. ...

  7. CodeForces 489B BerSU Ball (水题 双指针)

    B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  8. codeforces 577B B. Modulo Sum(水题)

    题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  9. Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树

    A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...

随机推荐

  1. WinForm——操作word文档

    解决方案资源管理器——引用——(右击)添加引用——COM 1. 安装Office,添加引用COM里面的 Microsoft Word 14.0 Object. Library 2. 导命名空间 usi ...

  2. ajax获取跨域数据

    1.效果图 2.源码 <%@ page contentType="text/html;charset=UTF-8" language="java" %&g ...

  3. javascript 的逻辑中断(短路操作)

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. PHP中的字符串类型

    PHP支持两种类型的字符串,这些字符串用引号说明. 1.如果希望赋值一个字面意义的字符串,精确保存这个字符串的内容,应该用单引号标注,例如: $info='You are my $sunshine'; ...

  5. C# 6.0新加特性

    1.自动属性的增强 1.1.自动属性初始化 (Initializers for auto-properties) C#4.0下的果断实现不了的. C#6.0中自动属性的初始化方式 只要接触过C#的肯定 ...

  6. dw2018修改为中文

    dw2018 英文版修改为中文, 把zh_CN文件夹内的内容复制到en_US文件夹内并替换, 或者重命名zh_CN文件夹为en_US

  7. switch 语句来选择要执行的多个代码块之一。

    switch(n) { case 1: 执行代码块 1 break; case 2: 执行代码块 2 break; default: n 与 case 1 和 case 2 不同时执行的代码 }

  8. 洛谷P2827 蚯蚓 队列 + 观察

    我们不难发现先被切开的两半一定比后被切开的两半大,这样就天然的生成了队列的单调性,就可以省去一个log.所以,我们开三个队列,分别为origin,big,smallorigin, big, small ...

  9. mysql出错ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

    其他的贴会教你 1.键盘上win+r 2.输入cmd 3.输入net  start mysql 但是还是没用 你可以试试 1.右击开始菜单 2.点击windows PowerShell(i) 3.输入 ...

  10. Scalable Web Architecture and Distributed Systems

    转自:http://aosabook.org/en/distsys.html Scalable Web Architecture and Distributed Systems Kate Matsud ...