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

水完40题发帖纪念

Posted by nixnus at 2008-07-01 21:36:16 on Problem 2909
#include<stdio.h>
#include<math.h>
int pr(int m)
 {int i;

     for(i=2;i<=sqrt(m);i++)
      if(m%i==0)
      return 0;

 return 1;
}
int gedebahe(int n)
{
 int i,sum=0;
for(i=2;i<n/2+1;i++)
  if(pr(i))
  if(pr(n-i))
   sum++;
   return sum;
}
void main()
{
 int n;
 while(scanf("%d",&n)&&n!=0)
 {
   printf("%d\n",gedebahe(n));

 }
    
}

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