标签:pre code ++ break init color nbsp eof sizeof
void init(){ //莫比乌斯函数线性筛 memset( prime , 0 , sizeof(prime) ); memset( mu , 0 , sizeof(mu) ); memset( vis , 0 , sizeof(vis) ); mu[1] = 1 ; cnt = 0 ; for( int i = 2 ; i < AX ; i++ ){ if( !vis[i] ){ prime[cnt++] = i ; mu[i] = -1; } for( int j = 0 ; j < cnt && i * prime[j] < AX ; j++ ){ vis[i*prime[j]] = 1 ; if( i % prime[j] ){ mu[i*prime[j]] = -mu[i]; }else{ mu[i*prime[j]] = 0 ; break; } } } }
标签:pre code ++ break init color nbsp eof sizeof
原文地址:https://www.cnblogs.com/xiaobuxie/p/12245537.html