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

我也晒下代码,没什么理论,就是靠着理解模拟,16MS

Posted by songzhenqi at 2010-10-20 17:06:58 on Problem 1007
#include <iostream>
using namespace std;
     

char DNA[105][55];
int nixushu[105];

int main()
{   freopen("in.txt","r",stdin);
	int n,m,p;
	int i,j;
	cin>>n>>m;
	for(i=0;i<m;i++)
	{	
		nixushu[i]=0;
		cin>>DNA[i];
		int k;
		for(j=0;j<n;j++)
			for(k=0;k<j;k++)
				if(DNA[i][k]>DNA[i][j])
					nixushu[i]++;
	}
	int h,min=999999999,minx;
	p=m;//循环变量P,用于while循环
	while(p--)
	{
		for(h=0;h<m;h++)
		{
			if(nixushu[h]<min)
			{
				min=nixushu[h];
			        minx=h;//记录逆序数最小值下标
			}
		}
		nixushu[minx]=999999999;
		min=99999999;
		cout<<DNA[minx]<<endl;
	}
	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