Skip to content

Instantly share code, notes, and snippets.

@Bekt
Created April 14, 2014 18:14
Show Gist options
  • Save Bekt/10670803 to your computer and use it in GitHub Desktop.
Save Bekt/10670803 to your computer and use it in GitHub Desktop.
CodeJam 2014 - Problem B
#!/usr/bin/env python3
'''Problem B: Cookie Clicker Alpha https://code.google.com/codejam/contest/2974486/dashboard#s=p1'''
def solve(c, f, x):
rate, total = 2.0, 0
m = x / rate
while m <= x:
total += (c / rate)
rate += f
t = total + (x / rate)
if m < t:
break
else:
m = t
return m
for x in range(int(input())):
nums = input().split()
ans = solve(float(nums[0]), float(nums[1]), float(nums[2]))
print('Case #{}: {:.8f}'.format(x + 1, ans))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment