題目連結: https://zerojudge.tw/ShowProblem?problemid=d385

# 解題思路

(string 是可以直接加的喔!!)
比較函數 (a+b)>(b+a) 時為 true

# 程式碼

#include <bits/stdc++.h>
using namespace std;
bool cmp(string a,string b){
    return (a+b)>(b+a);
}
int main(){
    int n;
    string s[50];
    while(cin>>n&&n){
        for(int i=0;i<n;i++)
            cin>>s[i];
        sort(s,s+n,cmp);
        for(int i=0;i<n;i++)
            cout<<s[i];
        cout<<endl;
    }
}
更新於 閱讀次數

用實際行動犒賞爆肝的我😀

Zrn Ye LinePay

LinePay