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

What's wrong??Thank you.

Posted by ass at 2003-11-20 17:01:40 on Problem 1007
#include "math.h"
#include "stdio.h"

void main()
{
	char a[100][52];
	int time,lenth,i,j,k,l,min;
	scanf("%d %d\n",&lenth,&time);
	for (i=0;i<time;i++)
	{
		for (j=0;(a[i][j]=getchar())!='\n';j++) {}
	    a[i][51]=0;
		for (k=0;k<lenth-1;k++)
		{
			for(l=k+1;l<lenth;l++)
			{
				if (a[i][k]>a[i][l]) a[i][51]++;
			}
		}
	}
    for(i=0;i<time;i++)
	{
		min=i;
		for(j=i+1;j<time;j++)
		{
			if (a[i][51]>a[j][51]) min=j;
		}
		for(k=0;k<lenth;k++)
		{
			printf("%c",a[min][k]);
            a[min][k]=a[i][k];
		}
		a[min][51]=a[i][51];
	    printf("\n");
	} 
}

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