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

参考

Posted by A0317462 at 2004-03-21 16:14:42 on Problem 1007
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>

char map[101][51];
int sign[101];
int value[101];
void main()
{
	int m,n,temp=0,tempSig=0;
	cin>>n>>m;
	for(int i=1;i<=m;i++)
		for(int j=1;j<=n;j++)
			cin>>map[i][j];
	for (i=1;i<m;i++)
		value[i]=0;
	for(i=1;i<=m;i++)
	{
		for(int ii=1;ii<=n;ii++)
		{
			
			for(int iii=ii;iii<=n;iii++)
				if(map[i][ii]>map[i][iii])
					value[i]++;
		}
	
	}

	for(i=1;i<=m;i++)
	{
		temp=10000;
		tempSig=0;
		for(int ii=1;ii<=m;ii++)
		{
			if(value[ii]<temp)
			{
				temp=value[ii];
				tempSig=ii;
			}
		}
		value[tempSig]=10001;
		for(int j=1;j<=n;j++)
			cout<<map[tempSig][j];
		cout<<endl;
	}
	
}

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