| ||||||||||
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 |
cout<<s<<' = '<<3<<' + '<<s-3<<endl;In Reply To:怎么总是Presentation Error ,我真的是没招了,那位能指点以下感激不尽 Posted by:wanglong at 2006-12-12 21:16:31 > #include<iostream.h> > int p(long n) > {if(n==3) return 1; > if(n%3==0) return 0; > int h=4; > for(int i=5;i*i<=n;i+=h) > {if(n%i==0) return 0; > h=6-h;} > return 1; > } > int main() > {long s,k=0; > while(1) > {cin>>s; cout<<endl;if(s==0) break; > if(p(s-3)==1) > cout<<s<<'='<<3<<'+'<<s-3<<endl; > else > {int h=4; > for(long i=5;i<=s/2;i+=h) > {if(p(i)==1&&p(s-i)==1) > { cout<<s<<'='<<i<<'+'<<s-i<<endl; > k=1;break;}h=6-h;} > if(k==0) > {cout<<"Goldbach's conjecture is wrong."<<endl;return 0;} > } > } > return 0; > } > Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator