题意:
n(10^5)个字符 光标停在第pos个字符上 光标可以左右任意移动 而且可以从最左移到最右也可以从最右移到最左 在光标处的字符可以按字母顺序或倒序更改 更改也可以a->z或者z->a 光标移动和字符更改都需要1s 问最短几s能把串变成回文的
思路:
最后的状态是一定的 因此更改的次数和策略无关 扫一遍就可以知道更改最少需要几s
光标移动需要一定的策略 容易想到...
分类:
其他好文 时间:
2014-11-21 21:56:23
阅读次数:
246
USACO Palindromic Squares...
分类:
其他好文 时间:
2014-11-19 20:35:38
阅读次数:
165
A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string"ABCDEDCBA"is a palindrome because...
分类:
其他好文 时间:
2014-11-17 15:45:48
阅读次数:
161
题意:
给一个字符x代表真实的a 然后输出的时候转换
然后就是求最长回文子串的串是什么 长度要大于1
思路:
就是裸的manacher,弄清楚下标的转换关系就好了
代码:
#include"cstdlib"
#include"cstdio"
#include"cstring"
#include"cmath"
#include"queue"
#include"algorithm"
#in...
分类:
其他好文 时间:
2014-11-17 12:26:57
阅读次数:
152
如果有一个正整数从左、右来读都是一样的,则称为回文式数(简称回数);比如101,32123,
999都是回数。求10000以内的所有回数。
判断的思路就是,通过循环依次把m的个位,十位,百位...上的数取出来,与sum*10相加。这样得到的数sum就是m颠倒之后的数,如果两者相等,那就是回文数。
while(a)
{
sum=sum*10+a%10;
a=a/10;...
分类:
其他好文 时间:
2014-11-17 10:46:41
阅读次数:
147
看到这个题目的时候,首先不认识 Determine这个单词,英文不好没办法,查了下是确认的意思,然后不懂 palindrome这个单词, 查了下是回文的意思。
问题是 回文是个什么东西,官方解释: A palindrome is
a word, phrase, number,
or other sequence of characters which
reads the same b...
分类:
其他好文 时间:
2014-11-17 01:45:30
阅读次数:
220
本厂做了3个水体,被略哭
水题1 暴力乱搞
题目:
回文数猜想
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4433 Accepted Submission(s): 2638
Problem D...
分类:
其他好文 时间:
2014-11-17 00:34:13
阅读次数:
399
【题目】
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
For example, given s = "aab...
分类:
其他好文 时间:
2014-11-16 17:23:33
阅读次数:
158
【题目】
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
[
...
分类:
其他好文 时间:
2014-11-16 17:22:42
阅读次数:
176
HDU 1431 素数回文(回文素数)
http://acm.hdu.edu.cn/showproblem.php?pid=1431
题意:
给你两个整数a,b。(5 <= a < b <= 100,000,000)要你按顺序输出[a,b]区间内的所有回文素数。
分析:
定理:如果一个数是回文且有偶数位,那么它能被11整除。
根据上面定理我们可知我们只需要找到区间[2,1000W)内的素数即可。(想想为什么)上面b的范围直接缩小了10倍。
剩下的工作就是用...
分类:
其他好文 时间:
2014-11-16 16:02:38
阅读次数:
183