| ||||||||||
| 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 | |||||||||
Re:你贴一下程序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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator