| ||||||||||
| 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 | |||||||||
利用数学In Reply To:怎么加速啊,有什么更快的算法吗? Posted by:dexter at 2004-03-07 21:17:36 我记得没错的话,是求n!的最后一位非零的吧?记为f(n)
根据式子
n-1
(5n)! = (10^n)n! ∏(5i+1)(5i+2)(5i+3)(5i+4)/2
i=0
可证明 f(5n)≡(2^n)f(n) (mod10)就可以了
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator