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:实现0MS啦!但是提交时间不同结果也不同啊!^_^,

Posted by steven7gao at 2011-10-16 16:45:59 on Problem 3006
In Reply To:实现0MS啦!但是提交时间不同结果也不同啊!^_^, Posted by:CCUT06 at 2009-03-10 19:43:38
是因为服务器这时候比较空闲吧
> Problem: 3006  User: CCUT06 
> Memory: 1216K  Time: 0MS 
> Language: C++  Result: Accepted 
> 
> #include "iostream"
> using namespace std;
> const int max = 1000005;
> bool prime[1000005] = {false};
> int main()
> {
> 	int		i,
> 			a,
> 			d,
> 			n,
> 			j;
> 
> 	//创建表
> 	memset(prime,true,sizeof(prime));
> 	
> 	for(i = 3 ; i <= 1000 ; i += 2 )
> 	{
> 		for(j = 3 ; j <= ::max / i ; j += 2)
> 		{
> 			if(prime[i])
> 			{
> 				prime[i * j] = false;	
> 			}	
> 		}	
> 	}
> 	for(i = 4 ; i <= ::max; i += 2 )
> 	{
> 		prime[i] = false;	
> 	}
> 	prime[1] = prime[0] = false;
> 	
> 	while(cin >> a >> d >> n,a != 0 && d != 0 && n != 0)
> 	{
> 		j = 0;
> 		for (i = a; j < n; i += d)
> 		{
> 			if (prime[i])
> 			{
> 				j++;
> 			}
> 		}
> 		cout << i - d << endl;
> 	}
> 	return 0;
> }

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