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. android-监听网络状态

    1.注册一个广播接收器,监听网络状态private void Start() { IntentFilter filter = new IntentFilter(); filter.addAction( ...

  2. AFNetworking 2.0 使用

    AFNetworking 下载地址:https://github.com/AFNetworking/AFNetworking/ AFNetworking 2.0 当Deployment Target ...

  3. .net 面试问题 汇总

    用.net做B/S结构的系统,您是用几层结构来开发,每一层之间的关系以及为什么要这样分层? 答: 从下至上分别为:数据访问层.业务逻辑层(又或成为领域层).表示层 数据访问层:有时候也称为是持久层,其 ...

  4. 使用 Bumblebee 控制 NVIDIA 双显卡

    简介 Nvidia的双显卡切换技术叫Optimus(擎天柱),可惜只能在win7.vista下实现.Linux下没有对应的技术,当然苹果也没有.这导致独立显卡一直在启用,显卡发热升温,风扇狂转,却没有 ...

  5. Java Day 08

    数组工具对象建立 多个.java文件先编译谁 数组工具类中静态的使用 构造函数私有化 数组工具类--文档注释 设计模式 -- 单例设计模式 保证一个类在内存中的对象唯一性 1.不允许其他程序使用new ...

  6. 最基础的Hash

    type thash=^node; node=record state:longint; next:thash; end; var a,i:longint; p:thash; hash:..]of t ...

  7. 团队开发---NABC分析

    我们的软件初步构想的是版主同学们解决宿舍订桶装水的问题,随着夏季的来临,桶装水的需求量日益加大,而我们订水的过程中常常会遇到这样或那样的问题.再次我只对我们项目中可以直观的看到今日卖家总库存水量和剩余 ...

  8. Linux 硬盘分区、分区、删除分区、格式化、挂载、卸载

    Linux 虽然一直都有在玩,但是对硬盘操作确实不是很熟悉今天有空,就整理了下. 1,创建分区 先查看下是否有磁盘没有分区 fdisk -l 其中第一个框和第二个框,是已经分好区的磁盘,第三个硬盘没有 ...

  9. 2. ProGit-Git基础

    (1) 取得项目的Git仓库 从工作目录中初始化新仓库 git init 从现有仓库克隆 git clone ssh协议 http协议 (2) 检查当前文件状态     git status (3) ...

  10. [转载]linux sed命令详解

    简介 sed 是一种在线编辑器,它一次处理一行内容.处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓冲区的 ...