Subscribe Us

Responsive Advertisement

Advertisement

615A Joysticks codeforces solution in cpp

 

615A Joysticks codeforces solution in cpp

by ujjal roy





#include<bits/stdc++.h>

using namespace std;

int main()

{

    int a,b,n,i,c=0;

    cin>>a>>b;

    while(1)

    {

        if((a==1&&b==1)||(a==0||b==0)) break;

        c++;

        if(a<b)

        {

            a++;

            b-=2;

        }

        else

        {

            b++;

            a-=2;

        }

    }


    cout<<c<<endl;



    return 0;

}


Post a Comment

0 Comments