Created
April 13, 2014 05:14
-
-
Save lucemia/10570268 to your computer and use it in GitHub Desktop.
code jam 2014 2
This file contains hidden or 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 sys | |
| def test(C, F, X, i): | |
| secs = X / (2.0+F*i) | |
| for j in range(i): | |
| secs += C / (2.0 + F*j) | |
| return secs | |
| def main(input): | |
| T = int(input.readline()) | |
| for i in range(T): | |
| C, F, X = map(float ,input.readline().split()) | |
| old_secs = -1 | |
| print 'Case #%s:' % (i+1), | |
| for i in range(int(X / C) + 2): | |
| secs = test(C,F,X, i) | |
| # print i, secs | |
| if old_secs > 0 and old_secs < secs: | |
| print old_secs | |
| break | |
| old_secs = secs | |
| input = sys.stdin | |
| main(input) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment