| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
提交N+1次了,老是RE,哪位大哥大姐帮小弟看看啊,感激不尽~~~#include <stdio.h>
#define MAX 1000001
bool t[MAX]={false};
void BuildPrime(){
long i,j;
for(i=2;i<MAX;i++){
if(t[i]==false)
for(j=i;i*j<MAX;j++)
t[i*j]=true;
}
t[0]=t[1]=t[2]=true;
}
int main(){
long n,c,l;
BuildPrime();
for(c=0;;c++){
scanf("%ld",&n);
if(n==0)
break;
for(l=1;l<=n;l++){
if(!t[l]&&!t[n-l]){
printf("%d = %d + %d\n",n,l,n-l);
break;
}
}
if(l==n+1)
printf("Goldbach's conjecture is wrong.\n");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator