标签:dfa 分享 max gif onclick closed 杨辉三角 play for
int C[25][25]; void init() { memset(C,0,sizeof(C)); C[0][0] = 1; for(int i = 1;i <= 24;i++) { for(int j =0;j <=i;j++) C[i][j] =C[i- 1][j-1]+C[i - 1][j]; } }//杨辉三角打表
long long pow_mod(long long x, long long n, long long mod) { long long res = 1; while (n) { if (n & 1) res = res * x % mod; x = x * x % mod; n >>= 1; } return res; } long long fac[Max]; long long n, m, p; int main() { while (~scanf("%lld %lld", &n, &m)) { p=1e9+7; fac[0] = 1; for (int i = 1; i <= n; i++) {fac[i] = fac[i - 1] * i % p;} //组合数 = n!*(m!%p的逆元)*((n-m)!%p的逆元)%p printf("%lld\n", fac[n] * pow_mod(fac[m], p - 2, p) % p * pow_mod(fac[n - m], p - 2, p) % p); } }
标签:dfa 分享 max gif onclick closed 杨辉三角 play for
原文地址:https://www.cnblogs.com/ww123/p/9569083.html