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

我的运行对了,为什么提交compile error? help!

Posted by 19871220 at 2008-03-08 14:06:37 on Problem 1007
#include <stdio.h>
#include <stdlib.h>
typedef struct{
       char a[100];
       int r;
       }DNA;
int athwart(char a[],int N)//统计每行的逆序数 
{
           int count=0;
           int i=0;
           while(i<N)
           {
                     int j=i+1;
                   while(j<N)
                  { if(a[i]>a[j])
                  count++;
                  j++;
                  }
                  i++;
             }
                  return count;  
}
int main(int argc, char *argv[])
{
  int n,m;
  scanf("%d %d",&n,&m);
    DNA d[m];
    int i=0;
    while(i<m)
    {
            scanf("%s",d[i].a);
            d[i].r=athwart(d[i].a,n);
            i++;
    }
         int j=0;//将每行的逆序数从小到大排序 
           while(j<m)
        {       DNA y;
            int s=0;
            while(s<m-j)
            {
                    if(d[s].r>d[s+1].r)
                   { y=d[s];
                    d[s]=d[s+1];
                    d[s+1]=y;
                    }
                    s++;
            }
                    j++;
        }                       
        int q=0;//输出 
        while(q<m)
        {
        printf("%s\n",d[q].a);
        q++;
        }     
  system("PAUSE");	
  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