codeforces651----A. Joysticks
1 //贪心,注意特判即可 2 #include <iostream> 3 using namespace std; 4 int main() 5 { 6 int a,b,ans = 0; 7 cin >> a >> b; 8 while(a+b > 1 && (a != 1 || b != 1) && (a!=0 && b!=0)) 9 { 10 ++ans; 11 if(a > b) {a -= 2; b+=1;} 12 else {a+=1; b-=2;} 13 } 14 cout << ans << endl; 15 return 0; 16 }