ACM_数据结构
知足--常乐
这个作者很懒,什么都没留下…
展开
-
HDU 6035-Colorful Tree(dfs+树)
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=6035 Problem Description There is a tree with n nodes, each of which has a type of color represented by an integer, where the color of node i is ci.The原创 2017-07-31 17:40:34 · 285 阅读 · 0 评论 -
hdu 3460-Ancient Printer(字典树&&贪心)
address:题目大意就是 给我一台打印机,但这台打印机比较古老,只有三种功能: 1 打印的都是小写字母 2 只能在 尾部追加 或者删除一个字母 3 打印当前单词 问输入的几个字符串 最少 多少步数可以打印完贪心+字典树既然最少步数 ,肯定 在最后一次打印时, 不再需要删除末尾单词操作, 那么肯定 最长的字符串 最后操作。 那么对应的其他 字母 都要 进行 增加和删除2步 同时,原创 2017-08-07 15:57:18 · 320 阅读 · 0 评论 -
HDU 2680-Choose the best route(Dijkstra)
Problem Description One day , Kiki wants to visit one of her friends. As she is liable to carsickness , she wants to arrive at her friend’s home as soon as possible . Now give you a map of the city’s原创 2017-09-13 14:31:54 · 508 阅读 · 0 评论 -
HDU 2923-Einbahnstrasse(floyd&&字符串输入)
address : http://acm.hdu.edu.cn/showproblem.php?pid=2923Problem Description Einbahnstra e (German for a one-way street) is a street on which vehicles should only move in one direction. One reason for原创 2017-09-13 17:37:20 · 587 阅读 · 0 评论 -
HDU 1385-Minimum Transport Cost(floyd&&最小字典序)
address : http://acm.hdu.edu.cn/showproblem.php?pid=1385Problem Description These are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there i原创 2017-09-09 15:32:09 · 637 阅读 · 0 评论 -
HDU 1869-六度分离(floyd)
address: http://acm.hdu.edu.cn/showproblem.php?pid=1869Problem Description 1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度原创 2017-09-10 20:30:26 · 577 阅读 · 0 评论 -
HDU 1874-畅通工程续(floyd&&Dijkstra)
address : http://acm.hdu.edu.cn/showproblem.php?pid=1874Problem Description 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需原创 2017-09-11 20:44:36 · 212 阅读 · 0 评论 -
HDU 2066-一个人的旅行(Dijkstra)
address: http://acm.hdu.edu.cn/showproblem.php?pid=2066Problem Description 虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,汗~),但是草儿仍然很喜欢旅行,因为在旅途中 会遇见很多人(白马王子,^0^),很多事,还能丰富自己的阅历,还可以看美丽的风景……草儿想去很多地方,她想要去东京铁塔看夜景,去威尼斯看电原创 2017-09-12 20:58:18 · 250 阅读 · 0 评论 -
HDU 1863 畅通工程(prim最小生成树)
Problem Description 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。Input 测试输入包含若干测试用例。每个测试用例的第1行给出评估的道路条数 N、村庄数目M ( < 100 );随后的原创 2017-10-19 20:32:39 · 292 阅读 · 0 评论 -
HDU-1102 Constructing Roads(prim)
There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only if th原创 2017-10-22 20:37:20 · 205 阅读 · 0 评论 -
HDU 4825 Xor Sum(字典树&&二进制)
传送门 : http://acm.hdu.edu.cn/showproblem.php?pid=4825Xor SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others) Total Submission(s): 3280 Accepted Submission(s): 14原创 2017-11-22 10:54:24 · 350 阅读 · 0 评论 -
hdu 1251-统计难题(字典树||map||数组)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1251Problem Description Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们原创 2017-08-05 15:18:15 · 748 阅读 · 0 评论 -
HDU 4970 Killing Monsters(树状数组 || 思维)
Problem Description Kingdom Rush is a popular TD game, in which you should build some towers to protect your kingdom from monsters. And now another wave of monsters is coming and you need again to kno原创 2017-12-05 19:27:07 · 322 阅读 · 0 评论 -
hdu 1075-What Are You Talking About(Map&&字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075 Problem Description Ignatius is so lucky that he met a Martian yesterday. But he didn’t know the language the Martians use. The Martian gives him a原创 2017-08-06 17:28:23 · 246 阅读 · 0 评论 -
hdu 1671-Phone List(字典树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1671Problem Description Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the原创 2017-08-05 17:42:14 · 299 阅读 · 0 评论 -
hdu 2072-单词数(字典树)
address:http://acm.hdu.edu.cn/showproblem.php?pid=2072Problem Description lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词的总数。下面你的任务是帮助xiaoou333解决这个问题。Input 有多组数据,每组一行,每组就是一篇小文章。每篇小文章都是由小写字母和空格组成,没原创 2017-08-07 17:40:02 · 435 阅读 · 0 评论 -
HDU 1698-Just a Hook(线段树区间更新)
address :http://acm.hdu.edu.cn/showproblem.php?pid=1698Problem Description In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of sev原创 2017-08-16 14:34:39 · 247 阅读 · 0 评论 -
HDU 1754-I Hate It(线段树单节点更新)
address : http://acm.hdu.edu.cn/showproblem.php?pid=1754Problem Description 很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input 本题目原创 2017-08-14 14:51:05 · 212 阅读 · 0 评论 -
HDU 1166-敌兵布阵(线段树单节点更新)
address :http://acm.hdu.edu.cn/showproblem.php?pid=1166Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C原创 2017-08-13 17:30:15 · 502 阅读 · 0 评论 -
HDU 1556-Color the ball(线段树区间更新)
address :http://acm.hdu.edu.cn/showproblem.php?pid=1556Problem Description N个气球排成一排,从左到右依次编号为1,2,3….N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽”牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出原创 2017-08-14 20:17:27 · 269 阅读 · 0 评论 -
HDU 6060 RXD and dividing (最小斯坦纳树)
address http://acm.hdu.edu.cn/showproblem.php?pid=6060Problem Description RXD has a tree T, with the size of n. Each edge has a cost. Define f(S) as the the cost of the minimal Steiner Tree of the原创 2017-08-09 17:01:51 · 290 阅读 · 0 评论 -
HDU 2795-Billboard
(题目链接)[http://acm.hdu.edu.cn/showproblem.php?pid=2795]Problem Description At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The原创 2017-07-25 11:53:09 · 256 阅读 · 0 评论 -
HDU 1217-Arbitrage(Floyd)
address:http://acm.hdu.edu.cn/showproblem.php?pid=1217Problem Description Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit o原创 2017-08-17 16:09:49 · 290 阅读 · 0 评论 -
HDU 2544-最短路(SPFA,Dijkstra,Floyd)
ADDRESS: http://acm.hdu.edu.cn/showproblem.php?pid=2544Problem Description 在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input 输入包括多组数据。每组数据第原创 2017-08-18 11:13:22 · 281 阅读 · 0 评论 -
ACM_并查集总结(转)
并查集,在一些有N个元素的集合应用问题中,我们通常是在开始时让每个元素构成一个单元素的集合,然后按一定顺序将属于同一组的元素所在的集合合并,其间要反复查找一个元素在哪个集合中。这一类问题近几年来反复出现在信息学的国际国内赛题中,其特点是看似并不复杂,但数据量极大,若用正常的数据结构来描述的话,往往在空间上过大,计算机无法承受;即使在空间上勉强通过,运行的时间复杂度也极高,根本就不可能在比赛规定的运行原创 2017-08-11 20:31:21 · 1456 阅读 · 1 评论 -
HDU 1232-畅通工程(并查集)
address :http://acm.hdu.edu.cn/showproblem.php?pid=1232Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input 测试输原创 2017-08-12 09:21:44 · 277 阅读 · 0 评论 -
hdu 1305-Immediate Decodability(字典树)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1305Problem Description An encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the prefix of a code for anothe原创 2017-08-05 13:10:57 · 252 阅读 · 0 评论 -
PAT L2-002. 链表去重
传送门: https://www.patest.cn/contests/gplt/L2-002给定一个带整数键值的单链表L,本题要求你编写程序,删除那些键值的绝对值有重复的结点。即对任意键值K,只有键值或其绝对值等于K的第一个结点可以被保留。同时,所有被删除的结点必须被保存在另外一个链表中。例如:另L为21→-15→-15→-7→15,则你必须输出去重后的链表21→-15→-7、以及被删除的原创 2018-01-18 20:30:29 · 257 阅读 · 0 评论