#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
bool compare(string &a, string &b) {
return (a + b) > (b + a);
}
int main() {
int n;
cin >> n;
vector<string> str(n, "");
for (int i = 0; i<n; i++) {
cin >> str[i];
}
//sort(str.begin(), str.end(), compare);
sort(str.begin(), str.end());
string res;
for(auto it=str.rbegin();it!=str.rend();it++)
{
res += *it;
}
//for (auto c : str) {
// res += c;
//}
if (res[0] == '0')
cout << 0 << endl;
else
cout << res << endl;
return 0;
}
给定一列非负整数,求这些数连接起来能组成的最大的数。
最新推荐文章于 2020-08-04 09:54:15 发布