A. Magic Spheres
 

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 andz 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 test(s)
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
Note

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.

 题意:给你三种球数量分别是a,b,c,对于两个相同的球可以转化为任意一个其他球,现在问你能否得到至少x,y,z三种球的数量

题解:

对于a-x,大于0,则价值为(a-x)/2;小于0,则价值为(a-x);b,c类似,最后判断价值是否为正就好了

//meek
///#include<bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <sstream>
#include <vector>
using namespace std ;
typedef long long ll;
#define mem(a) memset(a,0,sizeof(a))
#define pb push_back
#define fi first
#define se second
#define MP make_pair
inline ll read()
{
ll x=,f=;
char ch=getchar();
while(ch<''||ch>'')
{
if(ch=='-')f=-;
ch=getchar();
}
while(ch>=''&&ch<='')
{
x=x*+ch-'';
ch=getchar();
}
return x*f;
}
//**************************************** const int N=+;
const ll inf = 1ll<<;
const int mod= ; int main() {
int a,b,c,x,y,z;
scanf("%d%d%d",&a,&b,&c);
scanf("%d%d%d",&x,&y,&z);
int aa=a-x;
int bb=b-y;
int cc=c-z;
ll tmp=;
if(aa>) {
tmp+=(aa/);
}
else tmp+=(aa);
if(bb>) {
tmp+=(bb/);
}
else{
tmp+=(bb);
}
if(cc>) {
tmp+=(cc/);
}
else tmp+=(cc);
if(tmp>=) {
cout<<"Yes"<<endl;
}
else cout<<"No"<<endl; return ;
}

代码

Codeforces Round #335 (Div. 2) A. Magic Spheres 模拟的更多相关文章

  1. 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/ ...

  2. Codeforces Round #335 (Div. 2) 606B Testing Robots(模拟)

    B. Testing Robots time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...

  3. Codeforces Round #368 (Div. 2) B. Bakery (模拟)

    Bakery 题目链接: http://codeforces.com/contest/707/problem/B Description Masha wants to open her own bak ...

  4. Codeforces Round #335 (Div. 2)

    水 A - Magic Spheres 这题也卡了很久很久,关键是“至少”,所以只要判断多出来的是否比需要的多就行了. #include <bits/stdc++.h> using nam ...

  5. Codeforces Round #335 (Div. 2) A

    A. Magic Spheres time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  6. Codeforces Round #284 (Div. 2)A B C 模拟 数学

    A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard ...

  7. Codeforces Round #285 (Div. 2) A B C 模拟 stl 拓扑排序

    A. Contest time limit per test 1 second memory limit per test 256 megabytes input standard input out ...

  8. Codeforces Round #443 (Div. 1) D. Magic Breeding 位运算

    D. Magic Breeding link http://codeforces.com/contest/878/problem/D description Nikita and Sasha play ...

  9. Codeforces Round #350 (Div. 2) D1. Magic Powder - 1 二分

    D1. Magic Powder - 1 题目连接: http://www.codeforces.com/contest/670/problem/D1 Description This problem ...

随机推荐

  1. 如何使用 Microsoft Azure Media Services 现场直播,(Live Streaming) 直播流媒体系统

    不久之前,微软公司宣布了 Microsoft Azure Media Services 实时直播服务 ( Live ) 开始进入技术预览阶段,公开接受用户测试. 而这些实时直播服务其实早已被 NBC ...

  2. C#之玩转反射【转:http://www.cnblogs.com/yaozhenfa/p/CSharp_Reflection_1.html】

    前言 之所以要写这篇关于C#反射的随笔,起因有两个:   第一个是自己开发的网站需要用到   其次就是没看到这方面比较好的文章. 所以下定决心自己写一篇,废话不多说开始进入正题. 前期准备 在VS20 ...

  3. MongoDB 数据类型

    MongoDB支持许多数据类型的列表下面给出: String : 这是最常用的数据类型来存储数据.在MongoDB中的字符串必须是有效的UTF-8. Integer : 这种类型是用来存储一个数值.整 ...

  4. Orchard工作原理

    概述 本文翻译仅供学习之用,了解Orchard工作原理设计思想.技术点及关键词,如有缺漏请不吝指正.鉴于能力有限定有诸多曲解或不完整的地方,请海涵.不定时完善整理. CMS不像常规的web程序,它更像 ...

  5. [原创]一个纯css实现兼容各种主流移动pc浏览器的时间轴

    废话不多说 Demo 高度完全的自适应 中心思想是table 和第二列行高的50%的上下绝对定位竖线 第一次用codepen less完全不能用啊 连node png之类的都是关键词会被去掉... 马 ...

  6. Win8.1+vs2012+osg环境搭建

    Win8.1+vs2012+osg环境搭建 一.    相关准备 a) Osg源码 当前最新版:OpenSceneGraph-3.2.0.zip 下载链接: http://www.opensceneg ...

  7. apache maven

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAj0AAAGXCAYAAABY/uEUAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjw ...

  8. Bootstrap入门四:代码

    1.内联代码 code: 通过 <code> 标签包裹内联样式的代码片段.灰色背景.灰色边框和红色字体. For example, <code><section>& ...

  9. Asp.net操作Excel(终极方法NPOI)(转)

    原文:Asp.net操作Excel(终极方法NPOI) 先去官网:http://npoi.codeplex.com/下载需要引入dll(可以选择.net2.0或者.net4.0的dll),然后在网站中 ...

  10. Kibana 修改logo及汉化导航

    修改此文件下E:\happy\kinbana\kibana-4.2.2-windows\kibana-4.2.2-windows\optimize\bundles的kibana.bundle.js文件 ...