首先建立Trie和失败指针,然后你会发现对于每个节点 i 匹配AGCT时只有以下几种情况:
i 节点有关于当前字符的儿子节点 j 且安全,则i 到 j找到一条长度为 1的路。
i 节点有关于当前字符的儿子节点 j 且 不安全,则i 到 j没有路。
i 节点没有关于当前字符的儿子节点
但是能通过失败指针找到一个安全的节点j,那么 i 到 j 找到一条长度为1的路。
关于节点安全的定义:
...
分类:
其他好文 时间:
2014-08-17 15:36:52
阅读次数:
361
Description
It is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been intere...
分类:
其他好文 时间:
2014-08-16 23:52:11
阅读次数:
513
题意:看那张图就一清二楚了吧, N个序列首位相连(相同的序列部分),得到最短的总序列。
题目链接:http://poj.org/problem?id=1699
~~~~
思路就是:将N个序列首尾相连能重合的长度求粗来。然后DFS枚举每种首尾相连的情况。
#include
#include
#include
#define N 22
#define INF 0x7fffffff
us...
分类:
其他好文 时间:
2014-08-16 22:32:41
阅读次数:
185
UVA 1406 - A Sequence of Numbers
题目链接
题意:给定一些数字,每次操作
C x 表示所有数字加上x
Q x 表示答案加上与2x进行且操作不为0的个数
E 结束,并输出答案
思路:树状数组,首先观察,对于每次查询x而言,只有前x位是是有用的,所以可以开16个树状数组,每个数组表示数字对应前x位下的数字,然后就可以搞了,已经现在加过值为sum,...
分类:
其他好文 时间:
2014-08-16 17:10:20
阅读次数:
227
to get the ans of how many roads at most that can be built between two line without intersection of roads,we need sort the input sequence at ont edge ...
分类:
其他好文 时间:
2014-08-16 17:01:30
阅读次数:
288
Let us define a regular brackets sequence in the following way:
1. Empty sequence is a regular sequence.
2. If S is a regular sequence, then (S) and [S] are both regular sequences.
3. If A an...
分类:
其他好文 时间:
2014-08-16 15:10:30
阅读次数:
262
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of ...
分类:
其他好文 时间:
2014-08-16 12:37:20
阅读次数:
219
Oracle 下必须用Sequence[PrimaryKey(PrimaryKeyType.Sequence,"ID")]1、提示 ORA-02289: 序列不存在--CreatesequencecreatesequenceXXXminvalue1maxvalue999999999999999999...
分类:
系统相关 时间:
2014-08-16 12:26:20
阅读次数:
205
1306. Sequence Median
Time limit: 1.0 second
Memory limit: 1 MB
Language limit: C, C++, Pascal
Given a sequence of N nonnegative integers. Let's define the median of such sequence. If N is...
分类:
其他好文 时间:
2014-08-15 21:13:00
阅读次数:
247
One day, Twilight Sparkle is interested in how to sort a sequence of integersa1,?a2,?...,?anin non-decreasing order. Being a young unicorn, the only o...
分类:
其他好文 时间:
2014-08-15 20:55:49
阅读次数:
206