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

Re:RUNTIME ERROR数组开小了

Posted by clarencezi at 2011-05-16 18:14:36 on Problem 1007
In Reply To:RUNTIME ERROR数组开小了 Posted by:xfylyh at 2011-04-11 22:47:47
> 如题
#include"stdio.h"
main()
{
    int i,j,k,n,m,sum[101],min,sign;
	char s[101][51];
    scanf("%d%d",&n,&m);
    for(i=0;i<m;i++)
	{   sum[i]=0;
		scanf("%s",s[i]);
		for(j=0;j<n-1;j++)
			for(k=j+1;k<n;k++)
              if(s[i][j]>s[i][k]) sum[i]++;
	}
    for(i=0;i<m;i++)
	{   min=1000;
		for(j=0;j<m;j++)
		   if(min>sum[j]) {min=sum[j];sign=j;}
        printf("%s\n",s[sign]);
		sum[sign]=1001;
	}
}

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