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

whY my Programme is always judged to be " Output Limit Exceeded"?? (Problem 1007)

Posted by florida at 2008-04-12 23:05:18 and last updated at 2008-04-12 23:06:58
#include<stdio.h>
#include<stdlib.h>
#define ROW 100
#define COLUMN 50

int main()
{
	int m,n;
	int i,j,k;
	int count=0;
	char dna[ROW][COLUMN];
	char*p=NULL;
	int sort[ROW];
	int base[ROW];
	int min;
	int flag;	

	scanf("%d%d",&n,&m);
	getchar();
	for(i=0;i<m;i++)
	{
		gets(dna[i]);
		p=dna[i];
		for(j=0;j<n;j++)
		{
			for(k=n-1;k>j;k--)
			{
				if(p[j]>p[k])
				{
					count++;
				}
			}
			
		}
		sort[i]=count;
		count=0;
	}
	for(k=0;k<m;k++)
	{
		base[k]=k;
	}

	for(i=0;i<m;i++)
	{
		for(j=m-1;j>i;j--)
		{
			if(sort[i]>sort[j])
			{
				flag=base[j];
				base[j]=base[i];
				base[i]=flag;				
				min=sort[j];
				sort[j]=sort[i];
				sort[i]=min;
			}		
		}
	}

	for(i=0;i<m;i++)
	{
		puts(dna[base[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