
hdu
IDrandom
菜菜菜
展开
-
hdu1711Number Sequence
模板题吧 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1711#include <stdio.h>int a[1000010];int b[10010];int nxt[10010];void gtnxt(int l){ nxt[0]=-1; int i=0,j=-1; while(i<l){ i原创 2016-07-29 14:45:50 · 317 阅读 · 0 评论 -
hdu2102A计划(bfs)
hdu2102A计划A计划Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 33348 Accepted Submission(s): 8254Problem Description可怜的公主在一次次被魔王掳走一次次被骑士们救...原创 2019-03-11 12:53:37 · 183 阅读 · 0 评论 -
hdu1067Gap(bfs)
hdu1067GapGapTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1922 Accepted Submission(s): 978Problem DescriptionLet’s play a card game...原创 2019-03-10 19:42:30 · 208 阅读 · 0 评论 -
hdu3085Nightmare Ⅱ(双向BFS)
Nightmare ⅡTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4397 Accepted Submission(s): 1269Problem DescriptionLast night, little erriyue...原创 2019-03-04 18:30:09 · 325 阅读 · 3 评论 -
hdu1560DNA sequence(bfs)
DNA sequenceTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4685 Accepted Submission(s): 2241Problem DescriptionThe twenty-first century...原创 2019-02-26 17:25:44 · 190 阅读 · 0 评论 -
hdu3533Escape(bfs)
加一个时间维,暴力#include&lt;bits/stdc++.h&gt;using namespace std;char mp[105][105][1005];bool vis[105][105][1005];int dx[5]={-1,1,0,0,0};int dy[5]={0,0,-1,1,0};const int INF=0x3f3f3f3f;int m,n,k,d;s...原创 2019-02-25 19:17:55 · 139 阅读 · 0 评论 -
HDU1043 Eight(逆向BFS/A*/双向bfs/IDA*)
八数码cantor 展开:一个全排列的rank,用来hash逆向bfs:#include&amp;amp;amp;amp;lt;bits/stdc++.h&amp;amp;amp;amp;gt;using namespace std;typedef long long LL;#define INF 0x3f3f3f3fconst LL mod=1e9+7;const double eps=1e-9;string Input;char str...原创 2019-02-11 12:32:22 · 377 阅读 · 0 评论 -
hdu2567 EightII(IDA*/逆向BFS打表)
Eight IITime Limit: 4000/2000 MS (Java/Others) Memory Limit: 130000/65536 K (Java/Others)Total Submission(s): 5014 Accepted Submission(s): 1096Problem DescriptionEight-puzzle, which is also ...原创 2019-02-16 15:26:32 · 237 阅读 · 1 评论 -
hdu1238Substrings
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1238 这题枚举子串和它的反串暴力就能过#include <stdio.h>#include<iostream>#include<cstring>#include<cstdlib>#include<cmath>using namespace std;char p[105][105];cha原创 2016-08-01 15:04:33 · 773 阅读 · 0 评论 -
hdu2328Corporate Identity
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2328 找一个字典序最小的公共最长子串,枚举子串暴力就能过,这里有个小优化就是选取最短的字符串枚举其子串。#include <stdio.h>#include<iostream>#include<cstring>#include<cstdlib>#include<cmath>using nam原创 2016-08-01 15:12:57 · 643 阅读 · 0 评论 -
hdu4300Clairewd’s message(kmp||exkmp)( 模板 )
????:http://acm.hdu.edu.cn/showproblem.php?pid=4300 ??????to??????,?????????,?????????????,???????????,??????????(??+??) ???????????????????????????????ex[], ???s[]???,t[]???????,ex[i]?s[i]?t???????原创 2016-08-01 14:57:08 · 511 阅读 · 0 评论 -
hdu3336Count the string
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3336 给出一个字符串,求它的每一个前缀在整个字符串中出现的次数和 dp[i]代表以第i位结尾的字符串中包括多少以第i位字母结尾的前缀的出现次数 那么有dp[i]=dp[nxt[i]]+1 最后累加一下就好了 别忘了取模。#include <stdio.h>#include<cstring>原创 2016-07-29 16:26:25 · 371 阅读 · 0 评论 -
hdu2594Simpsons’ Hidden Talents
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2594 给你两个串s1和s2,问你s2的后缀和s1的前缀相等的最长长度 把s2接在s1后面,求出nxt[]数组以后就结束了。。。 注意长度不要超#include <stdio.h>#include<cstring>#include<iostream>#include<cmath>using原创 2016-07-29 16:14:24 · 285 阅读 · 0 评论 -
hdu1358Period(nxt找循环节)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1358 给你一个字符串,问它的前缀能不能表示成一个字符串重复k次,并按照前缀长度输出前缀长度和周期数。 求出nxt[]以后,扫一遍看长度是不是被循环节的长度整除#include <stdio.h>#include<cstring>using namespace std;char b[100001原创 2016-07-29 15:33:11 · 341 阅读 · 0 评论 -
hdu3746Cyclic Nacklace(kmp中nxt数组应用)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3746 用nxt数组求最短循环节 最短循环节为 T=len−nxt[len]T=len-nxt[len] 其中len为字符串长度,字符串是从0开始存的 题目要求凑成至少两个的循环要补多少个,那么算下循环节搞一搞就可以了#include <stdio.h>#include<cstring>us原创 2016-07-29 15:24:28 · 312 阅读 · 0 评论 -
hdu2087剪花布条
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2087 也是裸题,先剪一定优,匹配出一次以后不向回跳就行了#include <stdio.h>#include<cstring>#include<iostream>#include<algorithm>using namespace std;int nxt[1005];char a[10原创 2016-07-29 14:57:01 · 287 阅读 · 0 评论 -
hdu1686Oulipo
问子串在母串中出现了几次,kmp裸题。 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1686#include <stdio.h>#include<cstring>#include<cstdlib>#include<algorithm>using namespace std;int nxt[10010];char a[1000010];原创 2016-07-29 14:50:33 · 405 阅读 · 0 评论 -
HDU3001Travelling(状压dp)
题目链接dp[i][j]代表i节点为端点,点集状态为j的最小花费,j用三进制来操作就好了dp[i][j]代表i节点为端点,点集状态为j的最小花费,j用三进制来操作就好了dp[i][j]代表i节点为端点,点集状态为j的最小花费,j用三进制来操作就好了#include<bits/stdc++.h>using namespace std;typedef long long LL;L...原创 2019-04-19 23:24:55 · 229 阅读 · 0 评论