[恢]hdu 1194
2011-12-20 18:17:43
地址:http://acm.hdu.edu.cn/showproblem.php?pid=1194
题意:已知两数和与两数差,求俩数。
代码:
# include <stdio.h>
int main ()
{
int T, a, b ;
scanf ("%d", &T) ;
while (T--)
{
scanf ("%d%d", &a, &b) ;
if (a < b || (a+b)%2 == 1) {
puts ("impossible") ;
continue ;
}
printf ("%d %d\n", (a+b)/2, (a-b)/2) ;
}
return 0 ;
}