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. html中DTD使用小结

    DTD 是一套关于标记符的语法规则.它是XML1.0版规格得一部分,是html文件的验证机制,属于html文件组成的一部分. DTD:三种文档类型:S(Strict).T(Transitional). ...

  2. oracle11g安装与拆卸

    Oracle 11g安装 1.解压下载的包,然后进入包内,点击setup.exe开始安装 . 2.出现如下:一般把那个小对勾取消,点击下一步进行, 弹出下图这个后点'是' 3.下图后,选择创建和配置数 ...

  3. C# 6.0新加特性

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

  4. linux下的头文件和库文件搜索路径 (转)

     GCC 找头文件有三种策略: 1. 会在默认情况下指定到 /usr/include 文件夹 ( 更深层次的是一个相对路径, GCC 可执行程序的路径是 /usr/bin ,那么它在实际工作时指定头文 ...

  5. 【数据分析学习】Pandas学习记录

    import pandas as pd path = r'F:\数据分析专用\数据分析与机器学习\food_info.csv' with open(path, 'r') as f: data = pd ...

  6. 【前端】CSS隐藏元素的方法和区别

    CSS隐藏元素的方法和区别 <!DOCTYPE html> <html lang="en"> <head> <meta charset=& ...

  7. velocity.ui2.0所有的内置动画名称

    velocity升级到2.0后api发生了变化,按照原来的名称已经不能调用原来的动画效果,新的名称如下:velocity.ui2.0所有的内置动画名称 bounce flash headShake j ...

  8. Day 11 函数之对象和名称空间与作用域

    函数对象 函数是第一类对象,即函数可以被当做数据处理 函数对象的四大功能 1.引用 x=100 y=x def func() pass f=func print(f) #打印结果 #<funct ...

  9. HTTP 请求报文和响应报文分析和解刨!!

    http请求和响应报文分析 一>http请求报文主要包括三个部分:1.请求行:2.请求头:3;请求体: 1,请求行一般包括三个部分:请求方式:请求url : http协议版本. 请求方法:大部分 ...

  10. Vue学习之路第十二篇:为页面元素设置内联样式

    1.有了上一篇的基础,接下来理解内联样式的设置会更简单一点,先看正常的css内联样式: <dvi id="app"> <p style="font-si ...