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

自己写的快排超时了,用系统的倒过了 173ms 为什么????太郁闷了

Posted by fengyuehan at 2011-08-12 17:32:33 on Problem 1089
怎么回事?
下面是我写的快排
int one(struct s a[],int s,int e)
{
    struct s t,x=a[e];
    int i=s-1;
    int j;
    for(j=s;j<e;j++)
    {
        if(a[j].a<=x.a)
        {
            i++;
            t=a[j];
            a[j]=a[i];
            a[i]=t;
        }
    }
    t=a[i+1];
    a[i+1]=a[e];
    a[e]=t;
    return i+1;
}
void qsort(struct s a[],int s,int e)
{
    int q;
    if(s<e)
    {
        q=one(a,s,e);
        qsort(a,q+1,e);
        qsort(a,s,q-1);

    }
}

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