- 题目链接
- 灵光乍现,一开始写了很久的比较函数,后来在演草纸上写了两个数合并起来的样子得到的灵感。唉。。。看来敲代码是们艺术。
- AC code:
#include<iostream>
#include<algorithm>
using namespace std;
const int N=104;
string s[N];int n;
bool cmp(string a,string b){
if((a+b)>(b+a))return false;
else return true;
}
int main(){
ios::sync_with_stdio(false);cin.tie(0);
while(cin>>n){
for(int i=1;i<=n;i++)cin>>s[i];
sort(s+1,s+1+n,cmp);
for(int i=n;i>=1;i--)cout<<s[i];
cout<<endl;
}
}