Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
水完40题发帖纪念#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator