08-14-25
This commit is contained in:
@@ -1,31 +1,27 @@
|
||||
#include <cstring>
|
||||
#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(){
|
||||
char a[21][11];
|
||||
char sum[220]="";
|
||||
set<string, cmp> a;
|
||||
int n;
|
||||
cin>>n;
|
||||
|
||||
for(int i=0;i<n;i++){
|
||||
cin>>a[i];
|
||||
cin >> n;
|
||||
string tmp;
|
||||
for(int i = 0;i < n; i++){
|
||||
cin >> tmp;
|
||||
a.emplace(tmp);
|
||||
}
|
||||
int js=1;
|
||||
char tmp[11]="";
|
||||
while(js!=0){
|
||||
js=0;
|
||||
for(int i=0;i<n-1;i++){
|
||||
if(strcmp(a[i],a[i+1])<0){
|
||||
strcpy(tmp,a[i+1]);
|
||||
strcpy(a[i+1],a[i]);
|
||||
strcpy(a[i],tmp);
|
||||
js++;
|
||||
}
|
||||
}
|
||||
for(string x : a){
|
||||
cout << x ;
|
||||
}
|
||||
for(int i=0;i<n;i++){
|
||||
strcat(sum,a[i]);
|
||||
}
|
||||
cout<<sum<<endl;
|
||||
cout << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user