Files
ExerciseHub/Luogu/P1012 [NOIP 1998 提高组] 拼数.cpp
2025-08-14 12:59:59 +08:00

28 lines
364 B
C++

#include <iostream>
#include <set>
#include <string>
using namespace std;
struct cmp{
bool operator()(const string& a, const string& b){
return a + b > b + a;
}
};
int main(){
set<string, cmp> a;
int n;
cin >> n;
string tmp;
for(int i = 0;i < n; i++){
cin >> tmp;
a.emplace(tmp);
}
for(string x : a){
cout << x ;
}
cout << endl;
return 0;
}