给你几个数字
让你调整他们的摆放顺序
使得得出数最大
看了题解用sort水水的就过了
sort确实是要比qsort好用不少
还可以这样用,真是大开眼界
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int cmp(string a, string b){
return a + b > b + a;
}
string str[55];
int main(){
int n;
while (scanf("%d", &n) != EOF && n) {
for (int i = 0; i < n; i++)
cin>>str[i];
sort(str, str + n, cmp);
for (int i = 0; i < n; i++)
cout<<str[i];
cout<<endl;
}
return 0;
}