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 |
Re:暴水aaaaaaaaaaaaaaaaaa!!!!!!!!!!!!!!!!!!!!!附代码!!!!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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator