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 |
我哪里错了???!!帮我看看#include<stdio.h> #include<math.h> main() { int m,n,i,j,k,h,x; int a[1101]; while(scanf("%d%d",&m,&n)!=EOF) { printf("%d %d:",m,n); k=0; for(i=1;i<=m;i++) { x=sqrt((double)i); for(j=2;j<=x;j++) { if(i%j==0) break; } if(j>x) { a[k]=i; k++; } } if(m%2!=0) { n=2*n-1; } else { n=2*n; } if(n/2>k||n>k) { for(j=0;j<k;j++) printf(" %d",a[j]); } else if(n==2&&k<=3) printf(" %d",a[n-1]); else { h=(k-n)/2; for(j=h;j<h+n;j++) { printf(" %d",a[j]); } } printf("\n\n"); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator