fork download
  1. t = int(input()) # t converted to int form string
  2.  
  3. for i in range(1, t+1):
  4. arr = list(map(int,input().split()))
  5.  
  6. A = arr[0]
  7. B = arr[1]
  8. N = arr[2]
  9.  
  10. # / means float division e.g. 5 / 2 = 2.5
  11. # // means integer division e.g. 5 / 2 = 2
  12. # note the use of // instead of / for division in the following statements
  13.  
  14. if(N % 2 == 0):
  15. ans = max(A, B) // min(A, B)
  16. else:
  17. ans = max(2*A, B) // min(2*A, B)
  18.  
  19. print(ans)
Success #stdin #stdout 0.01s 28384KB
stdin
3
1 2 1
3 2 3
3 7 2
stdout
1
3
2