Skip to content

Instantly share code, notes, and snippets.

@Bekt
Created April 14, 2014 18:14
Show Gist options
  • Select an option

  • Save Bekt/10670803 to your computer and use it in GitHub Desktop.

Select an option

Save Bekt/10670803 to your computer and use it in GitHub Desktop.

Revisions

  1. Bekt created this gist Apr 14, 2014.
    21 changes: 21 additions & 0 deletions b.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/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))