Uva solution 12468 Zapping

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y,i,a=0,d=0,co=0;
    while(1)
    {
        cin>>x>>y;
        a=0;
        d=0;
        if(x==-1 && y==-1)
        {
            break;
        }
        if(x>y)
        {
            a=x-y;
        }
        if(y>x)
        {
            a=y-x;
        }
        d=100-a;
        if(d>a)
        {
            cout<<a<<endl;
        }
        else //if(a>d)
        {
             cout<<d<<endl;
        }

    }
    return 0;
}

Comments

Popular posts from this blog

Codeforces Solution 230B T-primes

Uri Solution 2747 Output 1