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 346125264 at 2015-04-06 11:28:46 on Problem 2909
#include<stdio.h>
int main()
{
	int m,sum,n,a,b;
	while(scanf("%d",&m),m)
	{
		a=0;b=0;
		sum=0;
		for(int i=2;i<=m/2;i++)
		{
			n=m-i;
			for(int j=2;j<i;j++)
			{
				if(i%j==0)
				{
					a=1;break;
				}
			}
			for(int j=2;j<n;j++)
			{
				if(n%j==0)
				{
					b=1;break;
				}
			}
			if(a==0&&b==0)
			sum++;
		}
		printf("%d\n",sum);
	}
	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