immuntasir

1

Feb 11th, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. int main() {
  3. int T;
  4. scanf("%d",&T);
  5. while (T--) {
  6. int a,b;
  7. scanf("%d%d",&a,&b);
  8. int c = a+b;
  9. int d = a-b;
  10. if (b>a || (c%2) != 0 || (d%2) !=0) {
  11. printf("impossible\n");
  12. }
  13.  
  14. else {
  15. c = c/2;
  16. d = d/2;
  17. if (c>d) {
  18. printf("%d %d\n",c,d);
  19. }
  20. else {
  21. printf("%d %d\n",d,c);
  22. }
  23. }
  24. }
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment