数据结构
一七得七
这个作者很懒,什么都没留下…
展开
-
hdu1251 统计难题 字典树
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1251Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input输入数据的第一部分是一张单词表,每行一个单词,原创 2016-08-15 23:33:41 · 324 阅读 · 0 评论 -
hdu 1754 I Hate It(线段树 点更新 最大值)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1754I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 70810 Accepted Submission原创 2017-03-11 20:38:12 · 249 阅读 · 0 评论 -
lightOj 1164 Horrible Queries (线段树)
World is getting more evil and it's getting tougher to get into the Evil League of Evil. Since the legendary Bad Horse has retired, now you have to correctly answer the evil questions of Dr. Horrible,原创 2017-03-04 09:34:45 · 338 阅读 · 0 评论 -
lightOj 1112 Curious Robin Hood (线段树)
Robin Hood likes to loot rich people since he helps the poor people with this money. Instead of keeping all the money together he does another trick. He keepsn sacks where he keeps this money. The s原创 2017-03-04 09:32:11 · 302 阅读 · 0 评论 -
UVa 442 Matrix Chain Multiplication 栈
题目链接:UVa442题目题目大意:输入n个矩阵的维度和一些矩阵链乘表达式,输出乘法的次数。如果乘法无法进行,输出error。假定A是m*n矩阵,B是n*p矩阵,那么AB是m*p矩阵,乘法次数为m*n*p。如果A的列数不等于B的行数,则乘法无法进行。思路:关键是解析表达式。本题表达式较为简单,可以借助一个栈来完成:遇到字母时压入栈,遇到右括号时出栈并计算,然后结果入栈。因为原创 2017-01-09 22:46:12 · 245 阅读 · 0 评论 -
UVa 514 Rails(铁轨) 栈
题目链接:UVa514题目(紫书)题目描述:某城市有一个火车站,有n节车厢从A方向驶入车站,按进站的顺序编号为1-n.你的任务是判断是否能让它们按照某种特定的顺序进入B方向的铁轨并驶入车站。例如,出栈顺序(5 4 1 2 3)是不可能的,但是(5 4 3 2 1)是可能的。题目分析:为了重组车厢,借助中转站,对于每个车厢,一旦从A移入C就不能回到A了,一旦从C移入B原创 2017-01-09 22:38:01 · 343 阅读 · 0 评论 -
hdu1686 Oulipo kmp
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1686OulipoTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11948 Accepted Submission(s):原创 2016-11-17 18:59:20 · 267 阅读 · 0 评论 -
hdu2087剪花布条(暴力模拟/kmp)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2087剪花布条Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 17225 Accepted Submission(s):原创 2016-11-17 18:54:13 · 394 阅读 · 0 评论 -
hdu1671 Phone List 字典树(小组赛E)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1671Phone ListTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18366 Accepted Submissio原创 2016-10-21 22:51:19 · 369 阅读 · 0 评论 -
hdu3746
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3746Problem DescriptionCC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, t原创 2016-09-04 23:19:48 · 727 阅读 · 0 评论 -
hdu1166 敌兵布阵 线段树 点更新
链接:点击打开链接Input第一行一个整数T,表示有T组数据。每组数据第一行一个正整数N(N接下来每行有一条命令,命令有4种形式:(1) Add i j,i和j为正整数,表示第i个营地增加j个人(j不超过30)(2)Sub i j ,i和j为正整数,表示第i个营地减少j个人(j不超过30);(3)Query i j ,i和j为正整数,i(4)End 表示结束原创 2016-08-18 23:29:26 · 1479 阅读 · 1 评论 -
线段树
内容来自石万东学长课件~1.问题给你一个数的序列A1A2……An。 并且可能多次进行下列两个操作 1、对序列里面的某个数进行加减 2、询问这个序列里面任意一个连续的子序列AiAi+1……Aj的和是多少。 希望第2个操作每次能在log(n)时间内完成2.线段树注意:线段树的分解: 如何从[1,9]分解出[2,8]转载 2016-08-18 17:26:10 · 938 阅读 · 0 评论 -
hdu1711 Number Sequence kmp算法
链接:点击打开链接(终于找到了按钮了)先放两个大牛写的kmp算法详解点击打开链接点击打开链接Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 100原创 2016-08-16 00:00:08 · 409 阅读 · 0 评论 -
poj 3468 A Simple Problem with Integers(线段树,区间更新)
链接:http://poj.org/problem?id=3468A Simple Problem with IntegersTime Limit: 5000MS Memory Limit: 131072KTotal Submissions: 104996 Accepted: 32769Case Time Limit: 200原创 2017-03-11 20:43:57 · 231 阅读 · 0 评论