| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
lucas啥的定理,把M,N分解为P进制来做In Reply To:C(N,M)%P,M<=N<=10^9,P为素数,该怎么做啊。。。。路过的帮忙看下哈。。。 Posted by:aclover at 2009-11-03 15:53:52 N分解完是(N[k],N[k-1]...N[0]) M分解完是(M[k],M[k-1]...M[0]) 然后计算c(N[i],M[i])的积,前提是P不大,百万级别,至于子问题就暴力分解素因子就可以了 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator