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 |
贴下我代码中的poll_rho函数,大牛帮我看下吧,过了1811,这里怎么也过不了。__int64 poll_rho(__int64 n) { int p=1; mod=n; while(p++) { srand(p); __int64 x=rand()%(n-2)+2; __int64 y=x; int k=0; int i=2; __int64 d=1; int time=0; while(time<50000)//防止出现死循环 { time++; k++; x=(mulmod(x,x)-1)%mod; if(x>y)d=gcd2(x-y,n); else d=gcd2(y-x,n); if(d>1&&d<n)return d; else if(d>=n)return -1; if(k==i) { y=x; i=i<<1; } } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator