洛谷 P1012 拼数
作者:互联网
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
using namespace std;
int cmp(string s1,string s2){
return s1+s2>s2+s1;
}
int main() {
string s[30];
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++){
cin>>s[i];//不能用scanf和printf直接输入输出,string是C++中特有的;
}
sort(s,s+n,cmp);
for(i=0;i<n;i++)
cout<<s[i];
return 0;
}
标签:洛谷,string,拼数,int,s2,s1,P1012,include,scanf 来源: https://www.cnblogs.com/half-joy/p/16179562.html