Codeforces 335A.Magic Spheres
2015-12-12 08:55
274 查看
(这种题居然要写解题报告我也是醉了,说好了要做点高难度的呢?!)
这题当时半夜没想明白,第二天在栗神的帮助理解下琢磨出来了。
一句话,作差大于0除以2小于零就不管最后求和看看是不是大于0就好了。。。
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int a, b, c, x, y, z;
while(~scanf("%d%d%d%d%d%d", &a, &b, &c, &x, &y, &z)){
int r = a - x;
int s = b - y;
int t = c - z;
if(r > 0) r = r / 2;
if(s > 0) s = s / 2;
if(t > 0) t = t / 2;
int sum = r + s + t;
if(sum >= 0) printf("Yes\n");
else printf("No\n");
}
return 0;
}
这题当时半夜没想明白,第二天在栗神的帮助理解下琢磨出来了。
一句话,作差大于0除以2小于零就不管最后求和看看是不是大于0就好了。。。
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int a, b, c, x, y, z;
while(~scanf("%d%d%d%d%d%d", &a, &b, &c, &x, &y, &z)){
int r = a - x;
int s = b - y;
int t = c - z;
if(r > 0) r = r / 2;
if(s > 0) s = s / 2;
if(t > 0) t = t / 2;
int sum = r + s + t;
if(sum >= 0) printf("Yes\n");
else printf("No\n");
}
return 0;
}
相关文章推荐
- JSON使用JsonPropertyAttribute
- Windows2003 IIS开启Gzip网页压缩
- 289. Game of Life
- Android短信发送流程之多收件人发送(原)
- python小程序3
- 全栈工程师杂说
- 实战mongodb3.06 Relica Sets+sharding集群
- 根据数据动态显示列及数据的SQL语句
- python战斗2:看到一个页面编码
- 使用CSVDE批量导入命令/出口AD用户
- 《LINUX程序设计 第四版》 阅读笔记:(一)
- HDU 1816, POJ 2723 Get Luffy Out(2-sat)
- POJ 3278.Catch That Cow
- 程序员代码面试指南:IT名企算法与数据结构题目最优解(题目)
- java中的静态方法
- python小程序2
- 音视频同步之时间戳
- 继承代码
- 继承
- 静态对象与非静态对象