- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 poj1204 字典树+DFS
#include#includeconst int N = 1008;const int CAP = 150;char stc[N][N];char word[N];int res[N][3];int dir[8][2]={0, -1, 1, -1, 1, 0, 1, 1, 0, 1, -1, 1, -1, 0, -1, -1};int ro
2015-08-17 15:35:01 440
原创 hdu 5389(dp)
#include#includeconst int N = 100008;const int MOD = 258280327;int arr[N];int dp[N][16];int main(){ int t; scanf("%d", &t); while(t--) { int n, a, b; scanf("%
2015-08-15 15:17:57 562
原创 poj 3630 Phone List(Trie)
这道题通过排序后,对于每个串只需与其前一个串与后一个串做比较来查前缀。我采用的是字典树(Trie), 昨天学的是动态建立的树,导致TLE。 然后学习了一下静态建立字典树。思路:插入串时检查当前插入串是不是之前已插入串的前缀,以及检查已插入串是不是当前插入串的前缀。#include#include#includeusing namespace std;const in
2015-08-14 16:46:28 451
原创 Hdu 5371 Manacher算法
Manacher算法:对于字符串str[ ], 找出所有以str[i]为中心的回文串的最长长度。#include#includeusing namespace std;const int N = 100008;int a[N];int b[N<<1];int p[N<<1];int len;void kp(){ int mx = 0, id = 0; fo
2015-08-13 09:59:52 351
原创 POJ1679 The Unique MST 次小生成树
#include#include#include#includeusing namespace std;const int N = 128;int g[N][N], vis[N], dis[N], pre[N], used[N][N], mmax[N][N];int n, m;struct Node{ int u, len; Node(){}; N
2015-08-11 16:55:48 320
原创 POJ 1639 最小度限制生成树
#include#include#include#include#include#define max(f, s) (f) > (s)? (f):(s)using namespace std;const int N = 32;const int INF = 0x3f3f3f3f;map mS2I;int num, k;int g[N][N], dis[N], max_
2015-08-10 14:33:05 403
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人