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 gemenhao at 2006-03-28 20:52:28 on Problem 2262
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:
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