519C Codeforces - A and B and team training






Solution in c++

#include <iostream>

using namespace std;

int xp,np,sol;

int main(){

cin>>xp>>np;

while((xp>=2 && np>=1) || (xp>=1 && np>=2))
{
    xp--;
    np--;
    sol++;
    if(xp>=np)xp--;
    else np--;
}
cout<<sol;

}

Share on Google Plus

About Mohamed Sobhi

My name is Mo.Sobhy ,I study at School excelling high school in Ain Shams ,Cairo
My hobbies is programming ,and web development ,playing chess and writing horror stories.
    Blogger Comment
    Facebook Comment

0 التعليقات:

إرسال تعليق