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

JAVA贡献了5次RE+6次TLE终于AC,亏在了BigInteger.isProbablePrime和Random.nextInt上

Posted by 110350328 at 2013-09-11 16:16:52 on Problem 1811
用BigInteger是可以的,但是别用isProbablePrime,一用就RE,看了JDK估计是静态方法getSecureRandom()抛的RE,由于是私有方法,不高兴重写BigInteger了,就用了自己的Miller-Rabin,结果又亏在了Random.nextInt上,特别要当心,这个随出来可以是负数的,要取绝对值后才能用.

解题代码参考的http://xingyezhi.diandian.com/post/2012-02-26/15529645

Pollard rho分解质因数

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