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 jimmysue at 2014-08-19 19:34:55 on Problem 2262
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char isprime[1000001];

int main()
{
	
	int i,j;int N;
	for(i = 2; i*i <= 100000; ++i){
		if(isprime[i] == 0)
		for(j = 2*i; j <=100000; j += i){
			isprime[j] = 1;
		}
	}
	// ok;
	
	while(1){
		scanf("%d",&N); 
		if(N == 0) break;
		for(i = 3; i <= N/2; i+=2){// 必须是<=. 6 = 3 + 3
			if(isprime[i]==0 && isprime[N-i]==0){
				printf("%d = %d + %d\n", N,i,N-i);
				break;
			}				
		}
	}
	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