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

求助啊!哪位大哥帮我看看是什么问题!谢谢啦!代码附下!

Posted by dingdongsheng at 2008-06-23 21:01:58 on Problem 2262
#include<stdio.h>
#include<memory.h>
int odd[1000001];
void main()
{
	int i,j;
	int x,count=0;
	memset(odd,1,sizeof(odd));
	for(i=2;i<=500000;i++)
	{
		if(odd[i])
		{
			for(j=2;j<1000000/i;j++)
				odd[i+i*j]=0;
		}
	}
	while(scanf("%d",&x),x)
	{
		if(x%2!=0||x<=6)
		{
			printf("Goldbach's conjecture is wrong.\n");
			continue;
		}
		for(i=3;i<=x/2;i+=2)
			if(odd[i]&&odd[x-i])
			{
				printf("%d = %d + %d\n",x,i,x-i);
				break;
			}
			
	}

}
谢谢!

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