ans

wyz2011 2023-11-25 16:08:28 4 返回题目

#include <bits/stdc++.h>
using namespace std;
string a[1005];
bool cmp(string s1, string s2) {
	return s1+s2>=s2+s1;
//    if (s1 + s2 >= s2 + s1) {
//        return true;
//    }
//    return false;
}

int main() {
    int i, n, t, j;
    cin >> n;
    for (i = 1; i <= n; i++) {
        cin >> a[i];
    }
    sort(a+1,a+1+n,cmp);

    for (i = 1; i <= n; i++) {
        cout << a[i];
    }

    return 0;
}
{{ vote && vote.total.up }}