POJ1816:Wild Words——题解】的更多相关文章

http://poj.org/problem?id=1816 比较麻烦的trie. 首先你需要选择针对n还是m建立trie,这里我选择了针对n. 那么就需要面临卡空间的问题. 这里提供了一种链式前向星的方法能够当你不会指针trie的时候卡过空间.(做法看代码吧) 然后针对m进行在trie上的dfs即可. 对于相同字符或?来说,trie下移1位,匹配串移动1位. 对于*来说,trie下移,匹配串移动0-长度位. (合计这道题就难在模拟上了) #include<cstdio> #include&l…
Wild Words Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 5567   Accepted: 1475 Description A word is a string of lowercases. A word pattern is a string of lowercases, '?'s and '*'s. In a pattern, a '?' matches any single lowercase, and…
A题 简单模拟. /************************************************************************* > File Name: A.cpp > Author: Stomach_ache > Mail: sudaweitong@gmail.com > Created Time: 2014年09月01日 星期一 08时08分12秒 > Propose: *******************************…
poj1816:http://poj.org/problem?id=1816 题意:给你n个模板串,然后每个串除了字母,还有?或者*,?可以代替任何非空单个字符,*可以替代任何长度任何串,包括空字符串.现在给以一些串,问你这些串在哪些串中出现过. 题解:trie+DFS.首先,把n个字符串放到trie中,注意,这n个串中可能有相同的字符串.然后对于每个要查询的串,从根节点进行DFS搜索,注意一些特殊处理,例如匹配到*或者?的处理. #include<iostream> #include<…
我要举报本次校赛出题人的消极出题!!! 官方题解请戳:http://3.scnuacm2015.sinaapp.com/?p=89(其实就是一堆代码没有题解) A. 树链剖分数据结构板题 题目大意:我没看,看不懂. 基本思路:我不会. 参考代码:找Oyk老师和Czj老师去. B. The background of water problem 题目大意(大写加粗的水题):给定$N$个学生和他们$K$个科目的成绩$S_i$,再给出各科目$K_i$的权重顺序$Q_i$,求排名之后,拥有id为$X$的…
以下代码为了阅读方便,省去以下头文件: #include <iostream> #include <stdio.h> #include <math.h> #include <string.h> #include <time.h> #include <stdlib.h> #include <string> #include <bitset> #include <vector> #include <…
2561: 最小生成树(题解) Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 1628  Solved: 786 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2561 Description 给定一个边带正权的连通无向图G=(V,E),其中N=|V|,M=|E|,N个点从1到N依次编号,给定三个正整数u,v,和L (u≠v),假设现在加入一条边权为L的边(u,v),那么需要删掉最少多少条…
Problems     # Name     A Infinite Sequence standard input/output 1 s, 256 MB    x3509 B Restoring Painting standard input/output 1 s, 256 MB    x2519 C Money Transfers standard input/output 1 s, 256 MB    x724 D Tree Construction standard input/outp…
题目链接 提交连接:http://acm-software.hrbust.edu.cn/problemset.php?page=5 1470-1482 只做出来四道比较水的题目,还需要加强中等题的训练. 题解: E666 这个题是让求有多少个子串只含有6.寻找连续的6,然后用n*(n+1)/2求出这一段的子串个数,然后把每一段连续的加起来. 做的时候wa了很多次,原来是在n*(n+1)的地方已经超过int型了,所以需要设置类型为long long. #include <cstdio> #inc…
A.Relic Discovery_hdu5982 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 57    Accepted Submission(s): 49 Problem Description Recently, paleoanthropologists have found historical remains on an…