Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- cases = int(raw_input())
- for c in xrange(cases):
- x = map(int, raw_input())
- y = map(int, raw_input().split())
- y = sorted(y, reverse=True)
- m = y[0]
- res = y[0]
- for r in range(1, m + 1):
- move = 0
- for z in y:
- if z <= r:
- break
- move += math.ceil(float(z) / float(r)) - 1
- if move + r < res:
- res = move + r
- print('Case #%d: %d' % (c + 1, res))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement