poj 1699 Best Sequence】的更多相关文章

id=1699" target="_blank" style="">题目链接:poj 1699 Best Sequence 题目大意:给定N个DNA序列,问说最少多长的字符串包括全部序列. 解题思路:AC自己主动机+状压DP,先对字符串构造AC自己主动机.然后在dp[s][i]表示匹配了s.移动到节点i时候的最短步数. #include <cstdio> #include <cstring> #include <queu…
题目: http://poj.org/problem?id=1699 无意间A了..超时一次,加了一句 if(len > ans)return; 然后就A了,dfs题,没有太多好说的,代码写的效率高一点就行. #include <stdio.h> #include <string.h> ][]; ]; ]; int ans, n; void dfs(int cnt, int x, char tmp[], int len) { if(len > ans)return; v…
http://poj.org/problem?id=1699 题意:给你n个长度为L的序列,求包含这几个序列的最短长度. 先预处理每两个序列之间的关系,然后dfs枚举就行. #include <cstdio> #include <cstring> #include <algorithm> #define maxn 500 using namespace std; <<; char str[maxn][maxn]; int c[maxn][maxn]; int…
意甲冠军:看图片是晶莹剔透的,正确的, N连接到第一序列(同样的序列部分).总序列获得最短. 主题链接:http://poj.org/problem?id=1699 ~~~~ 思路就是:将N个序列首尾相连能重合的长度求粗来. 然后DFS枚举每种首尾相连的情况. #include<cstdio> #include<cstring> #include<algorithm> #define N 22 #define INF 0x7fffffff using namespace…
題目鏈接 題意 : 將幾個片段如圖所示方法縮成一個序列,求出最短這個序列. 思路 : 其實我也不知道怎麼做.....看網上都用了DP.....但是我不會.....這個DP不錯,還有用KMP+状压DP做的 #include <iostream> #include <stdio.h> #include <string.h> #include <string> using namespace std; ] ; ][],ans ,n,vis[]; void f(in…
题目链接 题意:给出几个基因片段,要求你将它们排列成一个最短的序列,序列中使用了所有的基因片段,而且不能翻转基因. 分析:先计算出add数组,再dfs枚举. 空间复杂度O(n*n),  最坏时间复杂度 O(n^n),但是剪枝以后很快,因为好多搜不到后面,搜不到第n层. #include <iostream> #include <cstring> #include <cstdlib> #include <cmath> #include <cstdio&g…
[poj P1141] Brackets Sequence Time Limit: 1000MS   Memory Limit: 65536K   Special Judge Description 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 […
一.题目大意 有这样一个序列包含S1,S2,S3...SK,每一个Si包括整数1到 i.求在这个序列中给定的整数n为下标的数. 例如,前80位为11212312341234512345612345671234567812345678912345678910123456789101112345678910,第8位为2. 二.题解 动手做这道题之前要了解所求的是第n位而不是某一个Si中的第几个数,一位数占一位,两位数占两位,三位占三位...由于每一组都比前一组多一个数,如果这个数是一位数,则该组数的…
 名字是法雷数列其实是欧拉phi函数              Farey Sequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11246   Accepted: 4363 Description The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 <…
A - Farey Sequence Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2478 Description The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 &l…