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

郁闷S啦~```````

Posted by apple_SCUT at 2005-09-09 17:22:28 on Problem 1007
怎么可能WA呢~

#include <iostream.h>
#include <string.h>
int n,m;
int lenth[101];
char str[101][50];
int ord[101];
int main()
{int i,j,t;
    memset(lenth,0,sizeof lenth);
    cin>>n>>m;
    for(i=1;i<=m;i++) cin>>str[i];
    for(i=1;i<=m;i++)
        for(j=0;j<n;j++)
            for(t=j+1;t<n;t++) if (str[i][t]-'A'<str[i][j]-'A') lenth[i]++; 
    for(i=1;i<=m;i++) ord[i]=i;
    for(i=m;i>=1;i--)
        for(j=1;j<i;j++)
        {
            if (lenth[ord[j]]>lenth[ord[j+1]])
            {
                t=ord[j];
                ord[j]=ord[j+1];
                ord[j+1]=t;
            }
        }        
    for(i=1;i<=m;i++) cout<<str[ord[i]]<<endl;
    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