def f(n,m): if n == 0&nbs***bsp;m == 0: return 0 dp = [0] * (m // 3 + 1) dp[0] = n / (m + n) for i in range(1,m // 3 + 1): tmp = 1 for j in range(i * 3): tmp *= (m - j) / (m + n - j) dp[i] = tmp return ("%.4f" % sum(dp)) if __name__ == '__main__': a = list(int(x) for x in input().split()) n = a[0] m = a[1] print(f(n,m)) 第二题我这么写的,不知道对不对,交卷最后忘了保留四位小数....