#include"stdio.h"
#include"iostream"
#include"math.h"
#include"algorithm"
#include"string"
using namespace std;
typedef long long ll;
struct sb
{
string a;
int t;
friend bool operator < (sb a,sb b)
{
if(a.t<b.t) return true;
else return false;
}
}s[100+20];
int main()
{
int m,n;
while(cin>>m>>n)
{
for(int i=0;i<n;i++)
{
cin>>s[i].a;
s[i].t=0;
for(int j=0;j<m;j++)
{
for(int k=0;k<j;k++)
{
if(s[i].a[k]>s[i].a[j])
s[i].t++;
}
}
}
sort(s,s+n);
for(int i=0;i<n;i++)
cout<<s[i].a<<endl;
}
return 0;
}
POJ 1007 排序
最新推荐文章于 2022-10-16 09:02:39 发布