# include <stdio.h>
# include <iostream>
# include <algorithm>
# include <string.h>
using namespace std;
char a[100][100];
int ans[100][100];
struct nod
{
int xx;
int id;
}s[100];
int cmp(nod a,nod b)
{
return a.xx<b.xx;
}
int main()
{
int n,x;
int i,j,k;
while(scanf("%d%d",&x,&n)==2)
{
memset(ans,0,sizeof(ans));
for(i=0;i<n;i++)
{
s[i].xx=0;
s[i].id=i;
}
for(i=0;i<n;i++)
scanf("%s",a[i]);
for(i=0;i<n;i++)
for(j=0;j<x;j++)
for(k=j;k<x;k++)
if(a[i][j]>a[i][k])
ans[i][j]++;
for(i=0;i<n;i++)
{
for(j=0;j<x;j++)
{
s[i].xx+=ans[i][j];
}
}
sort(&s[0],&s[n],cmp);
for(i=0;i<n;i++)
printf("%s\n",a[s[i].id]);
}
return 0;
}
分享到:
相关推荐
DNA Sorting Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 34868 Accepted: 13480 Description One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are ...
pku acm 1007 DNA Sorting代码 逆序数 排序 解题报告请访问:http://blog.csdn.net/china8848
北大POJ1007-DNA Sorting 解题报告+AC代码
北大ACM习题 Problem 1007:DNASorting参考答案 可以accept,本人用的环境是codeblocks
poj dna sorting 问题,研究的ac coderrrrrrr
输入DNA序列,程序将把DNA序列翻译成对应的mRNA序列,把DNA序列翻译成对应的蛋白质序列
生成一个可以控制上下界限的随机数列,并使用选择排序selection sorting算法对其排序。
这是East Central North America 1998的测试数据,包括POJ的1007DNA Sorting等问提,利于大家思考。
javascript、sorting、algorithm
快速排序sorting
Java实现常用sorting算法,包括insertion, merge, bubble, heap, quick, couting, radix, bucket and maxHeap/Priority queue sorting。并对算法复杂度使用场景做了分析。 主要参考资料wikipedia, CLRS算法教材
Multi-objective evolutionary algorithms which use non-dominated sorting and sharing have been mainly criticized for their (i) computational complexity (where is the number of objectives and...
随机数列,可控制上下界线。冒泡算法,c++,bubble sorting
北大POJ1094-Sorting It All Out 解题报告+AC代码
为NGUI添加sortting layer,修改了3个文件,放在这里,覆盖掉以前的文件即可。 注意版本,我这个是NGUI 3.6.8基础上修改的。详细修改过程见我的博客文章。
An Adaptive Generic Sorting Algorithm that Uses Variable Partitioning。pdf.pdfAn Adaptive Generic Sorting Algorithm that Uses Variable Partitioning。pdf.pdfAn Adaptive Generic Sorting Algorithm that ...
The Art of Computer Programming Volume 3 Sorting and Searching, 2nd Edition
Algorithm-sorting-visualization.zip,生成gif的命令行工具,可以显示排序算法,算法是为计算机程序高效、彻底地完成任务而创建的一组详细的准则。
10-1 Sorting Concepts 10-2 Insertion Sorts 10-2-1 Straight Insertion Sort 10-2-2 Shell Sort 10-3 Selection Sorts 10-3-1 Straight Selection Sort 10-3-2 Heap Sort 10-4 Exchange Sorts 10-4-1 Bubble Sort ...