点击打开链接:http://acm.uva.es/local/online_judge/search_uva.html
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
const int MAXN = 60;
string str[MAXN];
int n;
int cmp(string a, string b)//注意这里应该比较的是a+b串和b+a串的大小,比如9+90为990和90+9为909应该是9在前而90在后。
{
return a+b > b+a ;
}
void solve()
{
int i;
for(i = 1; i <= n; i++) cin>>str[i];
sort(str+1, str+n+1, cmp);//快速排序算法
for(i = 1; i <= n; i++) cout<<str[i];
printf("\n");
}
int main()
{
while(scanf("%d", &n) && n)
{
solve();
}
return 0;
}