题目大意
奥西里斯之天空龙很喜欢颜色,有一天他找到了三种颜色——红黄蓝。
奥西里斯有a个红色,b个黄色,c个蓝色,他想用画出最好的画,可是需要至少x个红色,y个黄色和z个蓝色,似乎并不够。别担心,奥西里斯会魔法!他可以把任何两个同种颜色转化为一个另一种颜色!请问他能不能完成呢?
题目分析
一道简单的模拟水题。
代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| #include<algorithm> #include<iostream> #include<iomanip> #include<cstring> #include<cstdlib> #include<vector> #include<cstdio> #include<cmath> #include<queue> using namespace std; inline const int Get_Int() { int num=0,bj=1; char x=getchar(); while(x<'0'||x>'9') { if(x=='-')bj=-1; x=getchar(); } while(x>='0'&&x<='9') { num=num*10+x-'0'; x=getchar(); } return num*bj; } int t,a,b,c,x,y,z,More,Less; int main() { t=Get_Int(); while(t--) { a=Get_Int(); b=Get_Int(); c=Get_Int(); x=Get_Int(); y=Get_Int(); z=Get_Int(); More=Less=0; if(a>x)More+=(a-x)>>1; else Less+=x-a; if(b>y)More+=(b-y)>>1; else Less+=y-b; if(c>z)More+=(c-z)>>1; else Less+=z-c; if(More>=Less)puts("YES"); else puts("NO"); } return 0; }
|