| ||||||||||
| 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:真的很帅,请路过的大牛能解释下其中的原理,先谢了! Posted by:nothing828 at 2010-03-13 14:09:28 > for(int i = 2;i*i <= n;++i){
> if( n % i == 0 ){
> ans = ans - ans/i;
> while(n%i == 0){
> n /= i;
> }
> }
> }
> 有点像素数筛法,但具体原理还没有完全明白
ans/i是小于等于ans被i整除的数的个数..
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator