输入一个字符串,判断它是否为回文串以及镜像串。输入字符串保证不含数字0。所谓回文串,就是反转以后与原串相同,如abba和madam。所谓镜像串,就是左右镜像之后和原串相同,如2S和3AIAE。注意,并不是每个字符在镜像之后都能得到一个合法字符。(空白项表示该字符镜像后不能得到一个合法字符。)Character Reverse Character Reverse Character Reverse...
分类:
其他好文 时间:
2015-06-17 18:15:45
阅读次数:
142
Determine whether an integer is a palindrome. Do this without extra space.Some hints:
Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to string, note the...
分类:
其他好文 时间:
2015-06-13 09:48:14
阅读次数:
101
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i...
分类:
其他好文 时间:
2015-06-12 14:37:29
阅读次数:
107
Palindrome Number
Determine
whether an integer is a palindrome. Do this without extra space.
Some
hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of conver...
分类:
编程语言 时间:
2015-06-11 00:14:55
阅读次数:
173
题目链接:http://www.lightoj.com/volume_showproblem.php?problem=1033
题意:至少添加几个字符,能使得给定的串变为回文串。
解法:枚举起点终点,进行DP;
代码:#include
#include
#include
#include
#include <compl...
分类:
其他好文 时间:
2015-06-10 17:27:23
阅读次数:
112
题目:Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes?...
分类:
其他好文 时间:
2015-06-06 10:27:42
阅读次数:
102
// uva 11584 Partitioning by Palindromes 线性dp
//
// 题目意思是将一个字符串划分成尽量少的回文串
//
// f[i]表示前i个字符能化成最少的回文串的数目
//
// f[i] = min(f[i],f[j-1] + 1(j到i是回文串))
//
// 这道题还是挺简单的,继续练
#include
#include
#include
#i...
分类:
其他好文 时间:
2015-06-03 23:37:32
阅读次数:
325
/*ID: awsd1231PROG: pprimeLANG: C++*/#include#includeusing namespace std;int mayAns[] = {5, 7, 11, 101, 131, 151, 181, 191, 313, 353, 373, 383, 727, 7...
分类:
其他好文 时间:
2015-05-31 15:13:35
阅读次数:
200
/*ID: awsd1231PROG: dualpalLANG: C++*/#include#include#include#includeusing namespace std;const int maxn = 33;int n, s;char mayPal[maxn] = {0};bool is...
分类:
其他好文 时间:
2015-05-31 13:55:04
阅读次数:
66