赞
踩
MOD = int(1e9 + 7) def qmi(a, b): res = 1 while b > 0: if b & 1: res = res * a % MOD a = a * a % MOD b >>= 1 return res n = 10000 N = int(1e4 + 10) f = [[0 for i in range(N)] for i in range(N)] def init(): for i in range(0, n + 1): for j in range(0, i + 1): if j == 0: f[i][j] = 1 else: f[i][j] = (f[i - 1][j] + f[i - 1][j - 1]) % MOD init() res = 0 for i in range(1, n - 1 + 1): for j in range(1, n - i + 1): res = (res + f[n][i] * f[n - i][j] * qmi(7, n - i - j)) % MOD print(res)
运行结果:
157509472
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。