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 |
WHY PE#include"iostream" using namespace std; int main() { bool st[1100]={false}; int i=2; int j=2; int a[200]; for(i=2;i<=500;i++) { j=2; while(i*j<=1100) st[i*j++]=true; } j=0; for(i=1;i<1100;i++) if(!st[i]) a[j++]=i; int n,m; while(cin>>n>>m) { cout<<n<<" "<<m<<" :"; for(i=0;;i++) { if(a[i]>n) break; } if(2*m-1>=i) for(j=0;j<i;j++) cout<<" "<<a[j]; else if(i%2==0) for(j=i/2-m;j<i/2+m;j++) cout<<" "<<a[j]; else for(j=i/2-m+1;j<i/2+m;j++) cout<<" "<<a[j]; cout<<endl<<endl; } return 0; } 我再ZOJ是WA,再这里交是PE,检查了N小时了,还是不知道错了,哪位帮我看下好吗? 可以留言,也可以直接我QQ363583939 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator