Advertisement
arvind_iyer_2001

Problem A

Jul 7th, 2021
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. def s_a():
  2.     t = int(input())
  3.     arr = []
  4.     for i in range(t):
  5.        a, b = tuple([int(x) for x in input().split()])
  6.        a1, b1 =(a, b)
  7.        d = abs(a - b)
  8.        if (d == 0):
  9.            arr.append("0 0")
  10.        elif (d == 1):
  11.            arr.append("1 0")
  12.        else:
  13.            i = 0
  14.            m = a % d
  15.            if(m <= d//2):
  16.                i = m
  17.            else:
  18.                i = d - m
  19.  
  20.            arr.append("{} {}".format(d,i))
  21.     for el in arr:
  22.         print(el)
  23. # s_a()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement