Created
September 8, 2015 13:27
-
-
Save markroxor/f7af5a711924207400ef to your computer and use it in GitHub Desktop.
Correct Python solution BANROB LONG SEPT CF
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
mon = 10**9 | |
t = raw_input() | |
t = int(t) | |
for _ in xrange(t): | |
m,p = raw_input().split(); | |
m = int(m) | |
p = float(p) | |
if m%2: | |
fir=mon*(1+p**m) | |
else: | |
fir=mon*(1-p**m) | |
fir/=(1+p) | |
print fir, mon-fir | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment