-
-
Save GaZ3ll3/dbd7cdfb7e2b67069a69 to your computer and use it in GitHub Desktop.
google code jam 2015 qround
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment