- 博客(17)
- 资源 (5)
- 收藏
- 关注
原创 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
115
原创 SPOJ Find theClones 字典树/Map 两种方法都有
题目 Find the Clones Vjudge传送门 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
132
1
原创 洛谷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
134
原创 HDU1247 Hat‘s Words 字典树
一道折磨了我两个小时的字典树发现原来是字符串拆分… HDU传送门 Vjudgge传送门 题目 Hat’s Words Problem Description A 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. Input Stand
2021-08-05 13:35:01
151
2
原创 POJ2503 Babelfish 字典树
题目 POJ传送门 Vjudge传送门 Description You 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. Input Input consists of up to 100,000
2021-08-04 13:40:00
161
原创 HDU1251 统计难题 字典树模板题
题目 统计难题 HDU传送门 vjudge传送门 Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结束.第二部分是一连串的提问,每行一个提问,每个提问都是一个字符串. 注意:本题只有一组测试数据,处理
2021-08-04 13:08:32
128
原创 c++ istringstream 的用法 结合getline() 使用
istringstream在 #include<sstream> 头文件中。 个人理解用于切割字符串。 比如像。 Cat and Dog 这一行字符串。会进行空格之间的分割。 实践 #include<iostream> #include<sstream> using namsepace std; int main(int argc, char** argv){ ios::sync_with_stdin(false); string str = "Cat and
2021-08-03 21:47:45
356
原创 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
147
原创 洛谷 P2580 于是他错误的点名开始了 字典树模板题
这道题是字典树的模板题 传送门 题目 题目描述 这之后校长任命你为特派探员,每天记录他的点名。校长会提供化学竞赛学生的人数和名单,而你需要告诉校长他有没有点错名。(为什么不直接不让他玩炉石。) 输入格式 第一行一个整数 nnn,表示班上人数。 接下来 nnn 行,每行一个字符串表示其名字(互不相同,且只含小写字母,长度不超过 505050)。 第 n+2n+2n+2 行一个整数 mmm,表示教练报的名字个数。 接下来 mmm 行,每行一个字符串表示教练报的名字(只含小写字母,且长度不超过 505050)。
2021-08-03 16:30:40
163
原创 洛谷 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
212
原创 POJ 1742 Coins 动态规划多重背包
这是一道多重背包的动态规划的题目。 问有多少种。 传送门 Description People 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
134
原创 2019肇庆学院“菜鸟杯“程序设计竞赛题解
A 解锁专家 阿炳是一个精通文理的小机灵鬼,它是一个解锁专家,也是一个诗人。一天,阿炳受邀前往黄台甫马哈那坤弃他哇劳狄希阿由他亚马哈底陆浦欧叻辣塔尼布黎隆乌冬帕拉查尼卫马哈洒坦,也就是今天俗称的曼谷,解一个被文字锁锁住的宝箱。 文字锁是这样描述的, 对于给定的一个n,问存在多少正整数x满足: 1、x>0; 2、x二进制位的位数不超过n,例如5=101(2),它的二进制位的位数就是3; 3、x的二进制形式,不存在连续的两个二进制位上的数都是1。例如 3=11(2),则不满足条件,但是5=101(2) 则
2021-08-03 11:23:03
386
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人