poj1007

来源:互联网 发布:网络知识安全竞赛2017 编辑:程序博客网 时间:2024/05/16 06:36
//用G++提交 

#include
#include
using namespace std;
int main(){
int n,m;
while(scanf("%d%d",&n,&m)!=EOF&&n>0&&n<=50&&m>0&&m<=100){
  int a[105]={0},i=0,t;
    char b[105][55];
  t=m;
 while(t--){
cin>>b[i];
for(int j=0;j
 for(int k=j+1;k
  if(b[i][j]>b[i][k])
    a[i]++;
i++;
 }
for(int j=0;j
 for(int k=j+1;k
  if(a[j]>a[k]){
  swap(a[j],a[k]);
  swap(b[j],b[k]);
  }
for(int j=0;j
 cout<<b[j]<<endl;
return 0;  
}
0 0
原创粉丝点击