微扰法贪心经典题
#include <bits/stdc++.h>
using namespace std;
bool cmp(const string &x, const string &y) {
    return x + y > y + x;
}
int main() {
    int n;
    while (~scanf("%d", &n) && n) {
        string str[55];
        for (int i = 1; i <= n; ++ i) cin >> str[i];
        sort(str + 1, str + n + 1, cmp);
        for (int i = 1; i <= n; ++ i) cout << str[i];
        putchar(10);
    }
}原文:https://www.cnblogs.com/Alessandro/p/10011151.html