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

runtime error 是崩溃了,原因有很多,有可能是局部数组大了,有可能递归崩溃等,你把你那个数组开成全局的试试

Posted by hudedi at 2006-06-27 11:31:24 on Problem 1007
In Reply To:runtime error 是运行时间超出范围吗?那time limit exceed是什么,附我的程序,不知道为什么总是RE Posted by:XBR at 2006-06-26 21:32:22
> #include<stdio.h>
> #include<string.h>
> int main()
> {
>    char dna[100][50],temp[50];
>    int num,len,unsort_num[100],i,j,k,t;
>    scanf("%d %d",&len,&num);
>    if (num<=0||num>100||len<=0||len>50) 
>    {
>        printf ("input error.");
>        return -1;
>    }
>    for (i=0;i<num;i++)
>       scanf("%s",dna[i]);
>    for (i=0;i<num;i++)
>    {
>       unsort_num[i]=0; 
>       for(j=len-1;j>0;j--)
>             for(k=j;k>-1;k--)
>                      if (dna[i][j]<dna[i][k]) unsort_num[i]++;
>    }
>    for (i=0;i<num-1;i++)
>       for (j=i;j<num;j++)
>             if (unsort_num[i]>unsort_num[j])
>             {
>                 t=unsort_num[i];unsort_num[i]=unsort_num[j];unsort_num[j]=t;
>                 strcpy(temp,dna[i]);strcpy(dna[i],dna[j]);strcpy(dna[j],temp);
>             }
>    
>    for (i=0;i<num;i++)
>        printf("%s\n",dna[i]);                   
>    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