Created
July 11, 2016 12:01
-
-
Save bokuo-okubo/7a8052671be9df30dcaaa3dc0a09797a to your computer and use it in GitHub Desktop.
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
# coding: utf-8 | |
def func(n, m, N): | |
def state(cnt, acc): | |
if N == cnt: | |
return acc | |
else: | |
return state(cnt + 1, (1 - 1/n - 1/m) * acc + 1/m) | |
return state(0, 1) | |
def generalize(n, m, N): | |
alph = (n / (n + m)) | |
if N == 0: | |
return 1.0 | |
else: | |
return alph + (1 - alph) * pow(1 - 1/n - 1/m, N) | |
if __name__ == '__main__': | |
n, m, N = [float(num) for num in raw_input().split(' ')] | |
print generalize(n, m, N) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment