10905Children‘s game

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int cmp(string a,string b){
return a+b>b+a;
}
int main(){
int n;
while(scanf("%d",&n)==1 && n){
string buf[n];
int i,j;
for(i=0;i<n;i++){
cin>>buf[i];
}

sort(buf,buf+n,cmp);

for(i=0;i<n;i++) {
cout<<buf[i];
}

}
}

posted on 2017-03-10 19:16  whitehouse  阅读(71)  评论(0编辑  收藏  举报

导航