UVA 10812 - Beat the Spread! : Solution

#include <stdio.h>
int main()
{
    int n,a,b,x,y;
    scanf("%d",&n);
    while (n--)
    {
        scanf("%d%d",&a,&b);
        x=a+b;
        y=a-b;
        if (a<b || x%2==1 || y%2==1) printf("impossible\n");
        else printf("%d %d\n",x/2,y/2);
    }
    return 0;
}

Comments

Popular posts from this blog

Codeforces 698A - Vacations

UVA 11364: Parking -Solution

UVA 10550 - Combination Lock : Solution