hdoj 4554 叛逆的小明

//hdoj 4554
//2013-05-26-19.47
#include <stdio.h>

int turn(int x)
{
    int f = 1;
    if (x < 0)
    {
        x = -x;
        f = -1;
    }
    int s = 0;
    while (x)
    {
        s *= 10;
        s += x%10;
        x /= 10;
    }
    return s*f;
}

int main()
{
    int x, y;
    int t;
    scanf("%d", &t);
    while (t--)
    {
        scanf("%d %d", &x, &y);
        int a = (x+y)>>1;
        int b = x-a;
        a = turn(a);
        b = turn(b);
        printf("%d %d\n", a+b, a-b);
    }
    return 0;
}

原文地址:https://www.cnblogs.com/xindoo/p/3595090.html