提交时间:2023-12-31 14:58:36

运行 ID: 227853

#include <iostream> #include <algorithm> using namespace std; int n; string s[25]; bool comp(string a, string b) { return a + b > b + a; } int main() { cin.tie(0),cout.tie(0)->sync_with_stdio(0); cin >> n; for (int i = 1; i <= n; i++) { cin >> s[i]; } sort(s + 1, s + n + 1, comp); for (int i = 1; i <= n; i++) { cout << s[i]; } }