Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

lucas啥的定理,把M,N分解为P进制来做

Posted by majia5 at 2009-11-04 12:40:36
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator