摘要: 求C(n+m,m)%p ,n和m很大,p是小于10^5的素数。 LUCAS定理。 1 #include <string.h> 2 #include <stdio.h> 3 typedef long long LL; 4 int cas; 5 LL n, m, p; 6 LL fac[100005]; 7 LL powmod(LL a, LL b, LL p){ 8 LL ans = 1, tmp = a; 9 for (; b; b >>= 1, tmp = tmp * tmp % p)10 if (b&1) ans = ans * tmp % p; 阅读全文
posted @ 2012-10-09 14:03 Burn_E 阅读(258) 评论(0) 推荐(0)