Skip to content

Instantly share code, notes, and snippets.

@markroxor
Created September 8, 2015 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markroxor/f7af5a711924207400ef to your computer and use it in GitHub Desktop.
Save markroxor/f7af5a711924207400ef to your computer and use it in GitHub Desktop.
Correct Python solution BANROB LONG SEPT CF
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