P1012 [NOIP1998 提高组] 拼数

// Problem: P1012 [NOIP1998 提高组] 拼数
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1012
// Memory Limit: 125 MB
// Time Limit: 1000 ms
// User: Pannnn

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    
    vector<string> info(n);
    for (int i = 0; i < n; ++i) {
        cin >> info[i];
    }
    
    sort(info.begin(), info.end(), [](const string &s1, const string &s2) -> bool {
        return s1 + s2 > s2 + s1;
    });
    
    for (int i = 0; i < n; ++i) {
        cout << info[i];
    }
    cout << endl;
    return 0;
}
上一篇:刷题-力扣-面试题 01.09. 字符串轮转


下一篇:【Rust】所有权、引用、借用