- 博客(6)
- 收藏
- 关注
原创 hdoj1160最长上升子序列
//0MS 1688K #include #include #include #include using namespace std; #define MAX_N 1005 static struct mice { int w; int s; int index; }vecs[MAX_N]; static int cmp(mice&lhs,mice&rhs) { return
2015-05-30 22:19:39 442
原创 poj3342树形dp+深度搜索并确定唯一性
//树形dp入门题目 //使得每2个人之间不能有直接的上下级的关系,求最多能选多少个人出来,并且求出获得最大人数的选人方案是否唯一 //唯一性通过状态数组递归确定 //dp[i][0] = ∑max(dp[j][0], dp[j][1]) (j是i的儿子) // dp[i][1] = 1 + ∑dp[j][0] (j是i的儿子) //268K 32MS #include #include #
2015-05-27 22:33:34 372
原创 poj1204字典树+dfs搜索
//Trie树的题目8个方向从顺时针开始计算A->G对应从北方开始顺时针只回来 //思路:还是字符串查找问题 #include #include #include using namespace std; #define MAX_L 28 #define MAX_N 1010 struct wordPosition { int row; int col; int dir;
2015-05-22 18:48:17 405
原创 poj1961与poj2406同都是寻找循环节
//应该判断是否是循环节就是求的next数组 //5032K 172MS #pragma comment(linker, "/STACK:102400000,102400000") #include #include #include using namespace std; #define MAX_N 1000007 static char mol[MAX_N];//模式串 st
2015-05-19 19:09:34 371
原创 POJ2406寻找循环节
寻找循环节其实就是KMP中的NEXT数组的后缀在当前字符串中有多少重循环 //5028K 157MS #include #include #include using namespace std; #define MAX_N 1000007 static char mol[MAX_N];//模式串 static void initNext(int*NEXT) { int p=0
2015-05-19 19:07:19 526
原创 POJ2001Trie树的运用
//字符串的前缀处理问题:Trie树的运用 //同时前缀标出让其没有歧义:思路就是从子串中在Trie树中找到能够唯一标示的第一个字符为止 //Accepted 276K 16MS #include #include #include using namespace std; typedef struct node{ int L;//以当前开头的词的数目 char value; n
2015-05-01 21:22:43 337
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人