| ||||||||||
| 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:fjnu0205046 at 2005-03-17 15:59:47 void NFS(int max)
{
int inter,index,mqrt=(int)sqrt(max)+1;
for(int beg=3; beg <= mqrt; beg+=2)
{
index = beg*beg;
inter = beg<<1;
while(index < max)
{
isprime[index] = true;
index += inter;
}
while(isprime[beg+2] == true)
beg += 2;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator