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 |
怎么WA了?大家来看看#include<cstdio> #include<string> bool prime[33000]; void make() { int i,temp,j; memset(prime,true,sizeof(prime)); prime[1]=false; prime[0]=false; for(i=2;i<=182;i++){ j=i; temp=i*j; while(temp<=32768){ prime[temp]=false; temp=i*(++j); } } } int main() { int a,counter,i; make(); while(scanf("%d",&a)&&a){ for(counter=0,i=2;i<=a/2;i++){ if(prime[i]&&prime[a-i]) counter++; } printf("%d\n",counter); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator