码迷,mamicode.com
首页 >  
搜索关键字:回文    ( 4174个结果
Linux open函数
Linux open函数open 函数用于打开和创建文件。以下是 open 函数的简单描述#include int open(const char *pathname, int oflag, ... );返回值:成功则返回文件描述符,否则返回 -1对于 open 函数来说,第三个参数(...)仅当创...
分类:系统相关   时间:2015-01-30 19:21:14    阅读次数:235
Leetcode#5 Longest Palindromic Substring
原题地址最初的想法是用动态规划,令palin[i][j]表示s[i..j]是否是回文串,则有递推公式palin[i][j] = s[i] == s[j] && palin[i+1][j-1]。因为递推式只使用相邻层的值,所以编码的时候可以将二维状态数组压缩成一维的。代码: 1 string long...
分类:其他好文   时间:2015-01-30 17:03:05    阅读次数:105
hdu 1544 求字符串回文
#include #include int pal(char *str){ int len = strlen(str); int l, r; int ans = len; for(int i=0; i= 0 && r = 0 && r < len && str[l] == str[r]) {l--;...
分类:其他好文   时间:2015-01-29 14:06:24    阅读次数:151
POJ 1159-Palindrome(dp_回文串+滚动数组)
Palindrome Time Limit:3000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Description A palindrome is a symmetrical string, that is, a string read identic...
分类:编程语言   时间:2015-01-29 10:37:03    阅读次数:177
Python os.path模板函数
os.path.abspath(path) #返回绝对路径os.path.basename(path) #返回文件名os.path.commonprefix(list) #返回list(多个路径)中,所有path共有的最长的路径。os.path.dirname(path) #返回文件路径os.pat...
分类:编程语言   时间:2015-01-28 15:55:48    阅读次数:161
栈浅析[解密回文]
栈的实现很简单,只需要一个一维数组和一个指向栈顶的变量top就可以了。我们通过top来对栈进行插入和删除操作。      栈究竟有哪些作用呢?我们来看一个例子。“xyzyx”是一个回文字符串,所谓回文字符串就是指正读反读均相同的字符序列,如“席主席”、“记书记”、“aha”和“ahaha”均是回文,但“ahah”不是回文。通过栈这个数据结构我们将很容易判断一个字符串是否为回文。 ...
分类:其他好文   时间:2015-01-28 14:51:10    阅读次数:134
Codeforces Round #286 (Div. 2)
A题。。暴力枚举在每个位置添加字符,然后检查一下是不是回文串 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 8 using namespace std; 9 10 #define LL long ...
分类:其他好文   时间:2015-01-28 00:42:26    阅读次数:261
codeforces 505A. Mr. Kitayuta's Gift 解题报告
题目链接:http://codeforces.com/problemset/problem/505/A题目意思:给出一个长度不大于10的小写英文字符串 s,问是否能通过在字符串的某个位置插入一个字母,使得新得到的字符串成为回文串。 /********************************....
分类:其他好文   时间:2015-01-27 23:26:14    阅读次数:277
LeetCode Longest Palindromic Substring 最长回文子串
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.(最长回文子串) 中心扩展法: pub...
分类:其他好文   时间:2015-01-27 18:31:08    阅读次数:151
leetcode-----------Longest Palindromic Substring
题目:Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. 下面是英文,祝你好运 ...
分类:其他好文   时间:2015-01-27 16:35:09    阅读次数:363
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!