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 frkstyc at 2005-07-15 01:54:37 on Problem 2480
In Reply To:Re:你贴一下程序 Posted by:comerpass at 2005-07-15 01:38:16
> __int64 ph(int m)
> {
> 	int x=m;
> if(m<50&&p[m]) return p[m];
> 	__int64 r=1;
> 	for(int i=0;i<pr.size();i++){
> 		if(m%pr[i]==0){
> 			r*=pr[i]-1;m/=pr[i];
> 			while(m%pr[i]==0){m/=pr[i];r*=pr[i];}
> 		}
> 		if(m<50&&p[m]){r*=p[m]; break;}
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~这个优化是可疑的,不过去掉它之后TLE,总之硬来一般没有好结果
> 	}
> if(x<50)p[x]=r;
> return r;
> }

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