1. 程式人生 > >cf#516C. Oh Those Palindromes(最多回文子串的字串排列方式,字典序)

cf#516C. Oh Those Palindromes(最多回文子串的字串排列方式,字典序)

http://codeforces.com/contest/1064/problem/C

題意:給出一個字串,要求重新排列這個字串,是他的迴文子串數量最多並輸出這個字串。

題解:字典序排列的字串迴文子串最多。

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 char s[100005];
 4 int main()
 5 {
 6     int n;
 7     while(~scanf("%d",&n))
 8     {
 9         scanf("%s",s);
10         sort(s,s+strlen(s));
11 printf("%s\n",s); 12 } 13 return 0; 14 }