Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. tests = input()
  2. output = []
  3.  
  4. for i in xrange(tests):
  5.     inputs = raw_input()
  6.     inputs = inputs.split()
  7.     for i,n in enumerate(inputs):
  8.         inputs[i] = int(n)
  9.     N, C, M = inputs
  10.  
  11.     choc = wrap = N/C
  12.     while wrap >= M:
  13.         choc += wrap/M
  14.         wrap = wrap/M + wrap%M
  15.     output.append(choc)
  16.  
  17. for o in output:
  18.     print o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement