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 }

猜你喜欢

转载自www.cnblogs.com/fqfzs/p/9940583.html