poj2301

简单题

#include <cstdio>

int main()
{
    int t;
    scanf("%d", &t);
    while (t--)
    {
        int a, b, c, d;
        scanf("%d%d", &a, &b);
        c = (a + b) / 2;
        d = (a - b) / 2;
        if (a == c + d && b == c - d && c >= 0 && d >= 0)
            printf("%d %d\n", c, d);
        else
            printf("impossible\n");
    }
    return 0;
}
View Code

 

posted @ 2013-06-13 20:18  金海峰  阅读(287)  评论(0编辑  收藏  举报