Tuesday, May 3, 2011

10812 - Beat the Spread!


#include<stdio.h>
int main()
{
    unsigned long s,d,t;
    freopen("in.txt","r",stdin);
    scanf("%lu",&t);
    while(t--)
    {
        scanf("%lu%lu",&s,&d);
        if(s<d||(s+d)&1)printf("impossible\n");
        else printf("%lu %lu\n",(s+d)>>1,(s-d)>>1);
    }
    return 0;
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.