#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
bool cmp(string a, string b)
{
return a + b < b + a ? true : false;
}
string getmin(vector<int> nums)
{
vector<string> s;
string result = "";
int n = nums.size();
for (int i = 0; i < n; i++)
{
s.push_back(to_string(nums[i]));
}
sort(s.begin(), s.end(),cmp);
for (int i = 0; i < s.size(); i++)
{
result = result + s[i];
}
return result;
}
int main()
{
vector<int> nums;
int n;
int temp;
cin >> n;
while (n--)
{
cin >> temp;
nums.push_back(temp);
}
string result;
result = getmin(nums);
cout << result;
system("pause");
return 0;
}
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
bool cmp(string a, string b)
{
return a + b < b + a ? true : false;
}
string getmin(vector<int> nums)
{
vector<string> s;
string result = "";
int n = nums.size();
for (int i = 0; i < n; i++)
{
s.push_back(to_string(nums[i]));
}
sort(s.begin(), s.end(),cmp);
for (int i = 0; i < s.size(); i++)
{
result = result + s[i];
}
return result;
}
int main()
{
vector<int> nums;
int n;
int temp;
cin >> n;
while (n--)
{
cin >> temp;
nums.push_back(temp);
}
string result;
result = getmin(nums);
cout << result;
system("pause");
return 0;
}