codeforce 606A - Magic Spheres
生活随笔
收集整理的這篇文章主要介紹了
codeforce 606A - Magic Spheres
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
題意:a,b,c三種球,能把倆個一樣的球變成另一顏色不一樣的球。給你目標x,y,z,問能否經過變化至少達打目標。
1 #include<iostream> 2 #include<stdio.h> 3 #include<stdlib.h> 4 #include<memory.h> 5 #include<string.h> 6 #include<algorithm> 7 #include<cmath> 8 const int N = 30; 9 const int inf=-100000; 10 using namespace std; 11 int ans; 12 void fun(int x) 13 { 14 if(x>=0) 15 { 16 ans+=x/2; 17 } 18 else 19 { 20 ans+=x; 21 } 22 } 23 24 int main() 25 { 26 int a[3]; 27 int b[3]; 28 while(~scanf("%d%d%d",&a[0],&a[1],&a[2])) 29 { 30 scanf("%d%d%d",&b[0],&b[1],&b[2]); 31 ans=0; 32 fun(a[0]-b[0]); 33 //cout<<ans<<endl; 34 fun(a[1]-b[1]); 35 //cout<<ans<<endl; 36 fun(a[2]-b[2]); 37 //cout<<ans<<endl; 38 if(ans>=0) 39 { 40 cout<<"Yes"<<endl; 41 } 42 else 43 { 44 cout<<"No"<<endl; 45 } 46 } 47 return 0; 48 } View Code?
轉載于:https://www.cnblogs.com/ITUPC/p/5035618.html
總結
以上是生活随笔為你收集整理的codeforce 606A - Magic Spheres的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 对VS2008生成智能win32程序简单
- 下一篇: Cradle CFD—专业热流场分析工具