题解:
这道题最大的坑:32 和 321,32321 > 32132
1 #include <bits/stdc++.h> 2 using namespace std; 3 string a[25]; 4 bool cmp(const string &a, const string &b) 5 { 6 return (a + b > b + a); //这里太妙了 7 } 8 int main() 9 { 10 int n; 11 cin >> n; 12 for (int i = 1; i <= n; ++i) 13 cin >> a[i]; 14 sort(a + 1, a + 1 + n, cmp); 15 for (int i = 1; i <= n; ++i) 16 cout << a[i]; 17 }
标签:const,string,拼数,int,P1012,NOIP1998 From: https://www.cnblogs.com/nijigasaki14/p/17641126.html