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

为何我不能AC。。求助

Posted by hbhb41307 at 2014-01-19 20:10:05 on Problem 1007
#include<stdio.h>
#include<stdlib.h>
int main()
{
	char a[101][51];
	int i,j,n,m,k,max=0,x;
	scanf("%d%d",&i,&j);
	int b[j];
	fflush(stdin);
	for(m=0;m<j;m++)
	{
        fflush(stdin);
		for(n=0;n<i;n++)
		{
		    scanf("%c",&a[m][n]);
		}
		b[m]=0;
	}
	
	for(m=0;m<j;m++)
	{
		x=0;
		for(n=0;n<i-1;n++)
		{
			for(k=n+1;k<i;k++)
			{
				
				if(a[m][n]>a[m][k])
	            {
            		x++;
            	}
	            if(max<x)
	            {
            		max=x;
            	}
			}
		}
		b[m]=x;
	}
	for(k=0;k<=max;k++)
	{
		for(m=0;m<j;m++)
		{
			if(b[m]==k)
			{
				for(n=0;n<i;n++)
				{
					printf("%c",a[m][n]);
				}
				printf("\n");
			}
		}
	}
	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