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 poiulkj at 2007-04-14 13:22:11 on Problem 2262
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:
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