65,186
社区成员




// Example program
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
string largestNumber(vector<int> & v)
{
sort(v.begin(), v.end(), [](int a, int b)
{return to_string(a) + to_string(b) <= to_string(b) + to_string(a);});
string ans;
for(int i = v.size() - 1; i>=0; i--)
ans += to_string(v[i]);
return ans;
}
int main()
{
vector<int> a;
int len = 100;
for(int i=0; i<len; i++)
a.push_back(1);
string n;
n = largestNumber(a);
cout<< "res:" << n << endl;
return 0;
}
sort(v.begin(), v.end(), [](int a, int b)
{return to_string(a) + to_string(b) < to_string(b) + to_string(a);});
把所有
to_string(
改成
to_string((_ULonglong)