CodeForces--606A --Magic Spheres(模拟水题)
| Time Limit: 2000MS | Memory Limit: 262144KB | 64bit IO Format: %I64d & %I64u |
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
4 4 0
2 1 2
Yes
5 6 1
2 7 2
No
3 3 3
2 2 2
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
#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(模拟水题)的更多相关文章
- CodeForces 606A Magic Spheres
水题 /* *********************************************** Author :Zhou Zhentao Email :774388357@qq.com C ...
- Codeforces 631A Interview【模拟水题】
题意: 模拟模拟~~ 代码: #include<iostream> using namespace std; const int maxn = 1005; int a[maxn], b[m ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- POJ 2014:Flow Layout 模拟水题
Flow Layout Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3091 Accepted: 2148 Descr ...
- 【CodeForces 606A】A -特别水的题1-Magic Spheres
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102271#problem/A Description Carl is a beginne ...
- 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. ...
- CodeForces 489B BerSU Ball (水题 双指针)
B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- codeforces 577B B. Modulo Sum(水题)
题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树
A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...
随机推荐
- QlikSense移动端使用攻略
公司内部署QlikSense服务器,除了在电脑上用浏览器访问,也可以在移动端进行访问. 移动端访问在如下网址有英文详细介绍:https://community.qlik.com/docs/DOC-19 ...
- C# net winform wpf 发送post数据和xml到网页
由于项目需要发送数据到网页 这里用aspx做测试 采用post以及get发送数据,页面进行数据 首先这个东西很简单很简单,基本上学过的都会,但是原谅一直搞cs几乎不搞bs的猿类吧.三四年没接触bs. ...
- BZOJ4832: [Lydsy1704月赛]抵制克苏恩(期望DP)
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 913 Solved: 363[Submit][Status][Discuss] Description ...
- App Store兼容性问题
app下载出现兼容性问题 项目支持9.0以上的系统 但是10.3的iphone5下载的一直是老版本app 下载时提示不兼容 导致无法正常使用 解决办法: 修改Build-Settings-> ...
- 谈谈c++中继承中的虚函数
c++继承中的虚函数 c++是一种面向对象的编程语言的一个很明显的体现就是对继承机制的支持,c++中继承分很多种,按不同的分类有不同分类方法,比如可以按照基类的个数分为多继承和单继承,可以按照访问 ...
- boost多线程使用简例
原文链接:http://www.cppblog.com/toMyself/archive/2010/09/22/127347.html C++ Boost Thread 编程指南 转自cnblog: ...
- 03--实例讲解虚拟机3种网络模式(桥接、nat、Host-only)
前言 很多人安装虚拟机的时候,经常遇到不能上网的问题,而vmware有三种网络模式,对初学者来说也比较眼花聊乱,今天我就来基于虚拟机3种网络模式,帮大家普及下虚拟机上网的背景知识.(博文原创自http ...
- Final 用法
可修饰:类及类的成员.成员变量.局部变量,不能修饰构造方法 final修饰的类不能被继承但可以继承其他的类 final修饰的类不能被重写和继承,子类修改的方法可以加继承 final修饰的局部变量和成员 ...
- linux 性能分析与优化
一.影响Linux服务器性能的因素 1.操作系统级 (CPU 内存 磁盘I/O性能 网络带宽) 2.程序应用级 二.系统性能评估标准 好 坏 极差 cpu user% +sys% <70% ...
- IOS - NSDate 自己挖的坑,自己跳
NSDate:5是坑啊啊! NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDat ...