您的位置:首页 > 其它

hdoj 4554 叛逆的小明

2013-05-26 19:43 260 查看
//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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: