Sunday, April 24, 2016

UVA 10812 - Beat the Spread! : Solution

Unknown
#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;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,