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];
}

}
}

时间: 2024-10-06 23:44:57

10905Children‘s game的相关文章