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

Re:暴水aaaaaaaaaaaaaaaaaa!!!!!!!!!!!!!!!!!!!!!附代码!!!!

Posted by wocha at 2012-04-25 21:49:13 on Problem 2909
In Reply To:暴水aaaaaaaaaaaaaaaaaa!!!!!!!!!!!!!!!!!!!!! Posted by:wocha at 2012-04-25 21:48:43
#include<stdio.h>
#include<math.h>
int prime(int q)
{
 int k,l,w;
 k=sqrt(q*1.00);
 for(l=2;l<=k;l++)
	if(q%l==0) break;
	if(l>=k+1)  return 1;
	else return 0;
}
int main()
{
	int q,w,e,r,y,i,j;
	while(scanf("%d",&q),q)
	{
		int cnt=0;
		for(i=2;i<=q/2;i++)
		{
			if(prime(i)&&prime(q-i))

			// if(prime(i)&&prime(q-i)&&i==q-i)
			 cnt++;
		}
		printf("%d\n",cnt);
	}
}

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