Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

WHY PE

Posted by hyd1234 at 2008-07-26 08:22:27 on Problem 1595
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator