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

怎么WA了?大家来看看

Posted by godwon at 2009-08-16 16:29:36 on Problem 2909
#include<cstdio>
#include<string>
bool prime[33000];
void make()
{
	int i,temp,j;
	memset(prime,true,sizeof(prime));
	prime[1]=false;
	prime[0]=false;
	for(i=2;i<=182;i++){
		j=i;
		temp=i*j;
		while(temp<=32768){
			prime[temp]=false;
			temp=i*(++j);
		}
	}
}
int main()
{
	int a,counter,i;
	make();
	while(scanf("%d",&a)&&a){
		for(counter=0,i=2;i<=a/2;i++){
			if(prime[i]&&prime[a-i]) counter++;
		}
		printf("%d\n",counter);
	}
	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