def fac(n):
if n<2:
return 1
return n*fac(n-1)
def choose(n,r):
if r>n/2:
r=n-r
ans=1
for i in range(n,n-r,-1):
ans*=i
ans/=fac(r)
return ans
def Main():
while True:
m,w,c=map(int,input().split())
if m==0 and w==0:
return 0
pways=0
tways=0
p=m/(m+w)
q=1-p
for i in range(0,c+1):
tmp=choose(c,i)*(p**i)*(q**(c-i))
tways+=tmp
if i%2==0:
pways+=tmp
print("%1.7f"%(pways/tways))
if __name__=='__main__':
Main()
if n<2:
return 1
return n*fac(n-1)
def choose(n,r):
if r>n/2:
r=n-r
ans=1
for i in range(n,n-r,-1):
ans*=i
ans/=fac(r)
return ans
def Main():
while True:
m,w,c=map(int,input().split())
if m==0 and w==0:
return 0
pways=0
tways=0
p=m/(m+w)
q=1-p
for i in range(0,c+1):
tmp=choose(c,i)*(p**i)*(q**(c-i))
tways+=tmp
if i%2==0:
pways+=tmp
print("%1.7f"%(pways/tways))
if __name__=='__main__':
Main()
Comments
Post a Comment