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了呢?#include<stdio.h> int main() { int a,b; int m,number; int A[10000]; int i,j; for(i=0;i<10000;i++) A[i]=-1; scanf("%d %d",&a,&b); int t,q,p=0; for(t=1;t<=a;t+=2) { for(q=2;q<=t/2;q++) { if(t%q==0) //i不是素数 break; } if(q>t/2) A[p++]=t; } number=p-1; m=number/2; printf("%d %d:",a,b); if(b<=number) { if(number%2==1) for(j=m-(b-1);j<=m+(b-1);j++) printf("%d ",A[j]); else if(number%2==0) for(j=m-b;j<=m+b-1;j++) printf("%d ",A[j]); } else for(j=0;j<=number;j++) printf("%d ",A[j]); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator