Codeforces 335A.Magic Spheres

来源:互联网 发布:英文随机名字生成算法 编辑:程序博客网 时间:2024/05/03 12:27

(这种题居然要写解题报告我也是醉了,说好了要做点高难度的呢?!)


这题当时半夜没想明白,第二天在栗神的帮助理解下琢磨出来了。

一句话,作差大于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 0
原创粉丝点击