对于字符串函数 strcat 里面while(*strDest++ = *strSrc++) ; 这条语句是如何跳出语句的~~求大牛解释一下,感觉条件是个赋值语句,怎么样都不会出现false的啊~~本人愚笨求大家指点一下~~谢谢~~ 以下是我写的测试代码~~
#include
#include
#include
char * strcat(char * strDe...
分类:
其他好文 时间:
2014-07-09 13:10:45
阅读次数:
171
反转一个字符串
>>> S = 'abcdefghijklmnop'
>>> S[::-1]
'ponmlkjihgfedcba'
这种用法叫做three-limit slices
除此之外,还可以使用slice对象,例如
>>> 'spam'[slice(None, None, -1)]
>>>
unicode码与字符(single-character strings)之间...
分类:
编程语言 时间:
2014-07-09 13:08:50
阅读次数:
212
题目标题:
计算两个字符串的最大公共字串的长度,字符不区分大小写
输入两个字符串
输出一个整数
案例输入:asdfas werasdfaswer
案例输出:6
#include
#include
using namespace std;
int main()
{
string str1,str2,temp;
int m,MaxNum=0,Len;
cin>>str1>>str...
分类:
其他好文 时间:
2014-07-09 12:16:39
阅读次数:
416
http://202.121.199.212/JudgeOnline/problem.php?cid=1079&pid=21
分析: 回文串判断,字符串处理
1. atoi 函数(ascii tointeger 将字符串转换成整型数)
头文件: #include
int atoi(cons...
分类:
其他好文 时间:
2014-07-09 11:38:26
阅读次数:
208
C标准库中strtok的使用相关适宜,有关于strtok的非线程安全特质,以及strtok的替代函数strsep的用法...
分类:
其他好文 时间:
2014-07-09 11:35:46
阅读次数:
337
HTML5 增加了几个文档字符集属性。
document.charset : 表示文档的实际使用的字符集。
document.defaultCharset: 表示默认的字符集,跟浏览器以及操作系统设置有关。
如果文档没有使用默认字符集,那么 document.charset 与 document.defaultCharset 可能不同。
设置文档字符集: 但可以通过元素、响...
分类:
编程语言 时间:
2014-07-09 10:27:06
阅读次数:
205
后缀自动机(sam)上的字符串匹配
====
我们把相对较短的模式串构造成sam。
对于P="abcabcacab", T[1..i]的后缀,使得它是sam的最长前缀长度:
T: b a b c b a b c a b c a a b c a b c a b c a c a b c
1 1 2 3 1 1 2 3 4 5 6 7 1 2 3 4 5 6 7 5 6 7 8 9 1...
分类:
其他好文 时间:
2014-07-09 09:38:32
阅读次数:
162
eval()函数十分强大,官方demo解释为:将字符串str当成有效的表达式来求值并返回计算结果。
so,结合math当成一个计算器很好用。
其他用法,可以把list,tuple,dict和string相互转化。见下例子:
a = "[[1,2], [3,4], [5,6], [7,8], [9,0]]"
b = eval(a)
b
Out[3]: [[1, 2], [3, 4], [5...
分类:
编程语言 时间:
2014-07-09 09:26:53
阅读次数:
294
http://202.121.199.212/JudgeOnline/problem.php?cid=1079&pid=23
分析:
,
k1,k2,k3为不同单词的个数。
代码:
#include
#include
#include
#include
#include
#include
#i...
分类:
其他好文 时间:
2014-07-09 09:19:40
阅读次数:
221
题目链接:hdu 4850 Wow! Such String!
题目大意:给定一个n,要求输出一个长度为n的字符串,并且不会有长度大于等于4的重复的子串,不能得到输出impossible。
解题思路:这题有一个误导性的地方,500000,其实是构造不到那么长的,我们考虑所有不相同并且长度为4的串,一共有s=264个,那么我们假设有一个很长的串,满足不会有长度大于等于4的重复的子串,那么...
分类:
其他好文 时间:
2014-07-09 09:13:50
阅读次数:
195