ZOJ 3430 Detect the Virus(AC自动机)】的更多相关文章

题目链接:https://vjudge.net/problem/ZOJ-3430 Detect the Virus Time Limit: 2 Seconds      Memory Limit: 65536 KB One day, Nobita found that his computer is extremely slow. After several hours' work, he finally found that it was a virus that made his poor…
题目连接:zoj 3430 Detect the Virus 题目大意:给定一个编码完的串,将每个字符相应着表的数值转换成6位二进制.然后以8为一个数值,又一次形成字符 串,推断给定询问串是否含有字符集中的串. 解题思路:主要是题意,逆编码部分注意.转换完了之后,可能有字符'\0'.所以不能用字符串的形式储存.要用int型 的数组. 注意有同样串的可能. #include <cstdio> #include <cstring> #include <queue> #inc…
传送门: Detect the Virus                                                                                                                                                                                                                                     …
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3430 题意:给你n个编码后的模式串,和m个编码后的主串,求原来主串中含有模式串的个数 思路:首先要将模式串解码成未编码前来建立ac自动机,然后解码主串扫描统计即可. code: #include <cstdio> #include <cstring> #include <queue> #include <set> using…
Detect the Virus Time Limit: 2 Seconds      Memory Limit: 65536 KB One day, Nobita found that his computer is extremely slow. After several hours' work, he finally found that it was a virus that made his poor computer slow and the virus was activated…
解码的那些事儿,不多说. 注意解码后的结果各种情况都有,用整数数组存储,char数组会超char类型的范围(这个事最蛋疼的啊)建立自动机的时候不能用0来判断结束. #include <cstdio> #include <algorithm> #include <cstring> #include <queue> #include <string> #include <iostream> using namespace std; vec…
题意:问你主串有几种模式串.但是所有串都是加密的,先解码.解码过程为:先把串按照他给的映射表变成6位数二进制数,然后首尾衔接变成二进制长串,再8位8位取变成新的数,不够的补0.因为最多可能到255,所以不能用char存,要用int. 思路:模拟乱搞一下,加个板子完事. 代码: #include<cmath> #include<set> #include<map> #include<queue> #include<cstdio> #include&…
Searching the String Time Limit: 7 Seconds      Memory Limit: 129872 KB Little jay really hates to deal with string. But moondy likes it very much, and she's so mischievous that she often gives jay some dull problems related to string. And one day, m…
Detect the Virus Time Limit: 2 Seconds      Memory Limit: 65536 KB One day, Nobita found that his computer is extremely slow. After several hours' work, he finally found that it was a virus that made his poor computer slow and the virus was activated…
题意:每位十进制数都能转化为4位二进制数,比如9是1001,127是 000100100111,现在问你,在L到R(R <= $10^{200}$)范围内,有多少数字的二进制表达式不包含模式串. 思路:显然这是一道很明显的数位DP + AC自动机的题目.但是你要是直接把数字转化为二进制,然后在Trie树上数位DP你会遇到一个问题,以为转化为二进制后,前导零变成了四位000,那么你在DP的时候还要考虑前4位是不是都是000那样就要重新跑Trie树,显然这样是很菜(不会)的.那么肯定是想办法要变成十…