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

Re:遍历所有因子超时

Posted by DreamOfGame at 2009-08-18 21:07:25 on Problem 3696
In Reply To:遍历所有因子超时 Posted by:lihuiyykl at 2009-08-10 15:10:07
> 使用欧拉函数求出phi(m)值后,需要从小到大验证phi(m)的所有因子x,
> 如果phi(m)很大,那么它的因子x也可能很大,所以每次验证10^x mod m是否等于1也就用掉了很多时间,
> 我的程序因为这而超时,请问有什么好的方法能迅速验证10^x mod m是否等于1哇?大牛们多多指教,谢谢啦
直接验证就好了  sqrt(phi(m))*log2(m)的效率

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