classSolution { public: string largestNumber(vector<int>& nums){ sort(nums.begin(), nums.end(), [](int &x, int &y){ // 注意fx、fy为long int long fx = 10, fy = 10; while (fx <= x){ fx *= 10; } while (fy <= y){ fy *= 10; } return fy * x + y > fx * y + x; }); if (nums[0] == 0){ return"0"; } string ans = ""; for (auto &num : nums){ ans += to_string(num); } return ans;