• 欢迎光临~

P1012 [NOIP1998 提高组] 拼数

开发技术 开发技术 2022-01-29 100次浏览
// 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;
}
程序员灯塔
转载请注明原文链接:P1012 [NOIP1998 提高组] 拼数
喜欢 (0)
违法和不良信息举报电话:022-22558618 举报邮箱:dljd@tidljd.com