[Luogu1012]拼数
一开始脑抽写了个75分的玩意。。。然后看题解。。发现了@oier1459078309 的题解。。Orz
(这年头水题都这么玄了么)
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <string> using namespace std; string s[30]; int n; bool cmp(string &a,string &b){return a+b>b+a;} int main(){ ios::sync_with_stdio(false); cin>>n; for(int i=1;i<=n;i++)cin>>s[i]; sort(s+1,s+1+n,cmp); for(int i=1;i<=n;i++)cout<<s[i]; }