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

为什么会是WRONG呢?所有测试数据都对...

Posted by sAyTT at 2009-05-21 12:28:13 on Problem 2262
#include<stdio.h>
#include<math.h>
int main()
{
	long n,i,j,f;
	while(scanf("%ld",&n)==1&&n!=0)
	{
		for(i=n-3;i>=n/2;i-=2)
		{
			for(j=3;j<=sqrtl(i)+1;j+=2)
			{
				f=1;
				if(i%j==0)
				{
					f=0;
					break;
				}
			}
			if(f==1)
			{
				if(n-i==3)
					f=2;
				else for(j=3;j<=sqrtl(n-i)+1;j+=2)
					{
						f=2;
						if((n-i)%j==0)
						{
							f=0;
							break;
						}
					}
			}
			if(f==2)
			{
				printf("%ld = %ld + %ld\n",n,n-i,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