题目描述Give you a string S,assume the Sub-String Stri
= S[0..i] and the length of the string is N. e.g. S = "moreandmorecold", N = 15,
Str0 = "m" Str1 = ...
分类:
其他好文 时间:
2014-05-14 02:36:45
阅读次数:
314
本段程序实现串的存储结构是采用堆的动态分配存储表示,并实现了几乎所有常用的串的配套函数
其中逻辑性比较强的就是串的模式匹配算法,在下面的程序中,分别用BF算法和KMP算法对其进行了
实现。
#include
using namespace std;
struct HString
{
HString()
{
ch = 0;
length = 0;
}
char * ch;//...
分类:
编程语言 时间:
2014-05-14 01:12:35
阅读次数:
378
题目
Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
For "(()", the longest valid parentheses substring is "()", ...
分类:
其他好文 时间:
2014-05-14 01:10:30
阅读次数:
318
前面我们写了常见的几种排序算法,并分析了各种算法的实现思想,及时间复杂度等情况,但由于只是分析,木有实际的数据做对比测试,所以对各个算法的效率也没有一个明确的概念,下面我们就通过具体的测试来看看同算法之间的效率差距。声明11个长度为100的元素取值范围为0到1000的序列int
length = 1...
分类:
其他好文 时间:
2014-05-13 21:46:24
阅读次数:
323
Cut the Sequence
Time Limit: 2000MS
Memory Limit: 131072K
Total Submissions: 8764
Accepted: 2576
Description
Given an integer sequence { an } of length N, you are to ...
分类:
其他好文 时间:
2014-05-13 16:04:29
阅读次数:
267
不是很明白出题人的意图,其实这道题用java的话简直是太简单了,用split处理一下,得到所有单词的一个数组,然后求最后一个的长度就行了。我个人觉得java里最成功的函数就是split了,我做工程时几乎总能用到它,方便强大。
c++里面稍微复杂一些,不过这也算是最简单的字符串的问题了。函数的接口决定了字符串的长度是未知的,要自己循环找一下,然后从尾向头找不等于空格的字符,找到了就找到了最后一个单...
分类:
其他好文 时间:
2014-05-13 15:40:48
阅读次数:
222
中心节点就是树的中心,2遍dfs求到树的直径,而中心一定在直径上,顺着直径找到中心就够了。
然后可以一遍树形DP找到最小值或者二分+判断是否访问到叶子节点。
#include
#include
#include
#include
using namespace std;
struct node
{
int next;
int power;
int length...
分类:
其他好文 时间:
2014-05-13 11:28:38
阅读次数:
306
HITAG S--3rd generation HITAG? familyModulation
Read/Write Device to Transponder: 100 % ASK and Binary Pulse Length
CodingModulation Transponder to Re...
分类:
其他好文 时间:
2014-05-13 11:09:10
阅读次数:
336
#!/usr/bin/envpython#coding:utf8#随机生成自定义长度密码fromrandomimportchoiceimportstring,pickledefGenPassword(length=8,chars=string.ascii_letters+string.digits):return‘‘.join([choice(chars)foriinrange(length)])defpasslist(r_user,c_user,ip_list,web_list):di..
分类:
编程语言 时间:
2014-05-13 01:25:56
阅读次数:
505
You are given a string, S, and a list of words,
L, that are all of the same length. Find all starting indices of substring(s) in
S that is a concatena...
分类:
其他好文 时间:
2014-05-12 22:27:04
阅读次数:
265