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

哪位高人帮小弟看看这怎么情况 Output Limit Exceeded 谢了!

Posted by 2010201101 at 2011-02-08 18:38:10 on Problem 1007
#include<stdio.h>
#define N 100
#define M 50
int main()
{
    char a[N][M];
    int n,m,b[N][2]={0},t;
    for(int i=0;i<N;i++)
        b[i][0]=i;
    scanf("%d %d",&n,&m);
    for(int i=0;i<m;i++)
    {
        scanf("%s",&a[i]);
        for(int j=0;j<n-1;j++)
            for(int x=j+1;x<n;x++)
                if(a[i][x]<a[i][j])
                    b[i][1]++;
    }
    for(int i=0;i<m-1;i++)
        for(int j=1;j<m-i;j++)
            if(b[j][1]<b[j-1][1])
            {
                t=b[j][1];
                b[j][1]=b[j-1][1];
                b[j-1][1]=t;
                t=b[j][0];
                b[j][0]=b[j-1][0];
                b[j-1][0]=t;                    
            }
    for(int i=0;i<m;i++)
        printf("%s\n",a[b[i][0]]);
    return 0;    
}

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