#include<bits/stdc++.h>
#define debu
using namespace std;
int n;
string st[55];
int cmp(string st1,string st2)
{
return st1+st2>st2+st1;
}
int main()
{
#ifdef debug
freopen("in.in","r",stdin);
#endif // debgu
ios::sync_with_stdio(0);
while(cin>>n)
{
if(n==0) break;
for(int i=0; i<n; i++) cin>>st[i];
sort(st,st+n,cmp);
for(int i=0; i<n; i++) cout<<st[i];
cout<<"\n";
}
return 0;
}
题目地址:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1846
题解:sort排序。判断st1+st2与st2+st1的大小。