![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++
文章平均质量分 66
C/C++算法题解
Raoxiaomi.
多学习算法。
展开
-
洛谷 P1322 血色先锋队 题解 广度优先搜索
这是个题记广搜题改过一次之后就不会有更小的经过这个点所以无需判断这个点是否会有更小的点经过#include<bits/stdc++.h>using namespace std;#define ll long long int#define MAXN 100005#define FRE freopen("1.txt", "r", stdin)#define IOS ios::sync_with_stdio(false)//////////////////////////////原创 2021-08-03 12:13:56 · 162 阅读 · 0 评论 -
POJ 1742 Coins 动态规划多重背包
这是一道多重背包的动态规划的题目。问有多少种。传送门DescriptionPeople in Silverland use coins.They have coins of value A1,A2,A3…An Silverland dollar.One day Tony opened his money-box and found there were some coins.He decided to buy a very nice watch in a nearby shop. He wanted原创 2021-08-03 11:31:58 · 92 阅读 · 0 评论 -
HDU1247 Hat‘s Words 字典树
一道折磨了我两个小时的字典树发现原来是字符串拆分…HDU传送门Vjudgge传送门题目 Hat’s WordsProblem DescriptionA hat’s word is a word in the dictionary that is the concatenation of exactly two other words in the dictionary.You are to find all the hat’s words in a dictionary.InputStand原创 2021-08-05 13:35:01 · 101 阅读 · 2 评论 -
Problem C
#include<iostream>#include<cstring>#include<sstream>using namespace std;#define IOS ios::sync_with_stdio(false)const int N = 1e6 + 10;int tr[N][26], tot = 0;int End[N];void insert(string s) { int pos = 0; int len = s.length(); f原创 2021-08-10 19:44:23 · 81 阅读 · 0 评论 -
HDU1251 统计难题 字典树模板题
题目 统计难题HDU传送门vjudge传送门Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串.注意:本题只有一组测试数据,处理原创 2021-08-04 13:08:32 · 92 阅读 · 0 评论 -
洛谷 P2580 于是他错误的点名开始了 字典树模板题
这道题是字典树的模板题传送门题目题目描述这之后校长任命你为特派探员,每天记录他的点名。校长会提供化学竞赛学生的人数和名单,而你需要告诉校长他有没有点错名。(为什么不直接不让他玩炉石。)输入格式第一行一个整数 nnn,表示班上人数。接下来 nnn 行,每行一个字符串表示其名字(互不相同,且只含小写字母,长度不超过 505050)。第 n+2n+2n+2 行一个整数 mmm,表示教练报的名字个数。接下来 mmm 行,每行一个字符串表示教练报的名字(只含小写字母,且长度不超过 505050)。原创 2021-08-03 16:30:40 · 120 阅读 · 0 评论 -
POJ2503 Babelfish 字典树
题目POJ传送门Vjudge传送门DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.InputInput consists of up to 100,000原创 2021-08-04 13:40:00 · 113 阅读 · 0 评论 -
POJ 2001 Shortest Prefixes 字典树模板题
字典树模板题~传送门题目描述A prefix of a string is a substring starting at the beginning of the given string. The prefixes of “carbon” are: “c”, “ca”, “car”, “carb”, “carbo”, and “carbon”. Note that the empty string is not considered a prefix in this problem, but ev原创 2021-08-03 16:53:30 · 100 阅读 · 0 评论 -
洛谷P3372 线段树1 模板题
呜呜呜一道模板题在懒节点上找错找了快一个小时我是飞舞。洛谷传送门题目如题,已知一个数列,你需要进行下面两种操作:将某区间每一个数加上 kkk。求出某区间每一个数的和。输入格式第一行包含两个整数 n,mn, mn,m,分别表示该数列数字的个数和操作的总个数。第二行包含 nnn 个用空格分隔的整数,其中第 iii 个数字表示数列第 iii 项的初始值。接下来 mmm 行每行包含 333 或 444 个整数,表示一个操作,具体如下:1 x y k:将区间 [x,y][x, y][x,y] 内原创 2021-08-06 15:38:21 · 90 阅读 · 0 评论 -
SPOJ Find theClones 字典树/Map 两种方法都有
题目Find the ClonesVjudge传送门Doubleville, a small town in Texas, was attacked by the aliens. They have abducted some of the residents and taken them to the a spaceship orbiting around earth. After some (quite unpleasant) human experiments, the aliens clone原创 2021-08-07 15:47:16 · 92 阅读 · 1 评论