http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/A

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 ab 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, xy 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

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.

这题就是说两个相同的球可以变成一个任意一种球,现在问你能否得到各种球至少给定个?用当前的个数减去目标个数,如果是正数,多出来的可以拿去变成其它的,于是可以得到[差除以二]个其它球(整除),我们就ans+=差/2。如果是负数,就是需要变成[-差]那么多个,就ans+=差。最后ans是负数,则不能,否则能。

#include<stdio.h>
int main()
{
long long a,b,c,x,y,z,ans=;
scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&x,&y,&z);
a=a-x;
b=b-y;
c=c-z;
if(a>)ans+=a/;
else ans+=a;
if(b>)ans+=b/;
else ans+=b;
if(c>)ans+=c/;
else ans+=c;
if(ans>=)printf("Yes");
else printf("No");
return ;
}

  

【CodeForces 606A】A -特别水的题1-Magic Spheres的更多相关文章

  1. 【CodeForces 596A】E - 特别水的题5-Wilbur and Swimming Pool

    Description After making bad dives into swimming pools, Wilbur wants to build a swimming pool in the ...

  2. 【CodeForces 599A】D - 特别水的题4- Patrick and Shopping

    Description  meter long road between his house and the first shop and a d2 meter long road between h ...

  3. 【 CodeForces 604A】B - 特别水的题2-Uncowed Forces

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/B Description Kevin Sun has jus ...

  4. 【CodeForces 602A】C - 特别水的题3-Two Bases

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/C Description After seeing the ...

  5. Codeforces Round #335 (Div. 2) A. Magic Spheres 水题

    A. Magic Spheres Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/606/ ...

  6. Codeforces Round #378 (Div. 2) D题(data structure)解题报告

    题目地址 先简单的总结一下这次CF,前两道题非常的水,可是第一题又是因为自己想的不够周到而被Hack了一次(或许也应该感谢这个hack我的人,使我没有最后在赛后测试中WA).做到C题时看到题目情况非常 ...

  7. CodeForces.158A Next Round (水模拟)

    CodeForces.158A Next Round (水模拟) 题意分析 校赛水题的英文版,坑点就是要求为正数. 代码总览 #include <iostream> #include &l ...

  8. Codeforces Round #612 (Div. 2) 前四题题解

    这场比赛的出题人挺有意思,全部magic成了青色. 还有题目中的图片特别有趣. 晚上没打,开virtual contest打的,就会前三道,我太菜了. 最后看着题解补了第四道. 比赛传送门 A. An ...

  9. Codeforces 828B Black Square(简单题)

    Codeforces 828B Black Square(简单题) Description Polycarp has a checkered sheet of paper of size n × m. ...

随机推荐

  1. liunx中的进程与线程

    1. 进程和线程 进程和线程是程序运行时状态,是动态变化的,进程和线程的管理操作(比如,创建,销毁等)都是有内核来实现的. Linux中的进程于Windows相比是很轻量级的,而且不严格区分进程和线程 ...

  2. IL查看委托

    查看委托的IL 通过IL来查看委托的原理, 委托示例代码 写一个委托的类如下 using System;   namespace MyCollection { //定义一个类,该类包含两个静态方法 c ...

  3. 在3D Max中查看模型引用的贴图

    需求 假如在Max中有一个模型,想查看贴图 操作步骤 1.右上角点击 2.在弹出材质编辑器中 点击吸管 3.把吸管点击在角色模型上,然后点击M 4.点击查看图像 5.就能查看到模型使用的贴图

  4. SQL Server进制

    在项目中,大家可能都遇到过,需要把十进制转换为其他进制的情况,google上一搜,已经有很多2进制.8进制.16进制和十进制的转换方法.但是在一些项目中,这些可能无法满足要求,可能需要17.18甚至是 ...

  5. java 8-5 抽象

    1. 抽象类的概述: 动物不应该定义为具体的东西,而且动物中的吃,睡等也不应该是具体的. 我们把一个不是具体的功能称为抽象的功能,而一个类中如果有抽象的功能,该类必须是抽象类. 抽象类的特点: A:抽 ...

  6. 关于软件测试人员能力模型的建立(from知乎)

    转自: http://www.zhihu.com/question/20254092 测试思维方面:1.测试基础理论(测试流程.测试的基础知识)2.测试用例设计方法论(黑盒.白盒)3.软件质量体系(建 ...

  7. linux64需要增加的依赖库

    sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl zlib1g-dev gcc-multi ...

  8. C语言 共用体

    //共用体 union #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> #includ ...

  9. 使用地址栏访问CXF Webservice写法

    /* * 通过url调用 * http://localhost:8080/EFP/webService/TestWebservice/testOut/arg0/liuyx */ http://loca ...

  10. U3D5.3.5f Monodevelop 仅支持到.NET 3.5

    2016年12月2号:发现这个标题是错误的,可以在monodevelop中选择.NET的版本,如下:打开solution,右击 Assembly-CSharp,options, build, gene ...