Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import math
  2. cases = int(raw_input())
  3. for c in xrange(cases):
  4. x = map(int, raw_input())
  5. y = map(int, raw_input().split())
  6. y = sorted(y, reverse=True)
  7. m = y[0]
  8. res = y[0]
  9. for r in range(1, m + 1):
  10. move = 0
  11. for z in y:
  12. if z <= r:
  13. break
  14. move += math.ceil(float(z) / float(r)) - 1
  15. if move + r < res:
  16. res = move + r
  17. print('Case #%d: %d' % (c + 1, res))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement