- 博客(288)
- 收藏
- 关注
原创 POJ 3070 Fibonacci(矩阵快速幂)
FibonacciDescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2,
2016-08-19 19:58:41 239
原创 POJ 2349 Arctic Network(最小生成树)
Arctic NetworkDescriptionThe Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used
2016-08-18 22:57:51 368
原创 HDOJ 1875 畅通工程再续(最小生成树)
畅通工程再续Problem Description相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离
2016-08-18 22:42:47 349
原创 CodeForces 115A Party(并查集)
A. PartyA company has n employees numbered from 1 to n. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. A
2016-08-18 15:41:47 496
原创 POJ 1724 ROADS(BFS + 优先队列)
ROADSDescriptionN cities named with numbers 1 ... N are connected with one-way roads. Each road has two parameters associated with it : the road length and the toll that needs to be paid f
2016-08-17 23:46:33 420
原创 POJ 2485 Highways(最小生成树)
HighwaysDescriptionThe island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopian government is awa
2016-08-17 22:16:13 263
原创 CSUOJ 1256 天朝的单行道(最短路)
1256: 天朝的单行道Description 在另一个平行宇宙中,有一个神奇的国度名叫天朝。天朝一共有N个城市(标号分别为1, 2, …, N),M条道路,为了方便交通管制,天朝的M条道路都是单行道。 不久前天朝大选,小Q当选了天朝的总统。小Q家住在城市1,但天朝的办公地点在城市N,于是为了便于工作,小Q决定举家从城市1搬迁到城市N去居住。然而小Q惊奇的发
2016-08-17 17:04:54 313
原创 HDOJ 1874 畅通工程续(最短路)
畅通工程续Problem Description某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input本题目包含多
2016-08-16 22:59:44 301
原创 CodeForces 471D MUH and Cube Walls(KMP)
D. MUH and Cube WallsPolar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started makin
2016-08-16 20:08:14 438
原创 HDOJ 1072 Nightmare(BFS)
NightmareProblem DescriptionIgnatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyri
2016-08-16 16:51:31 356
原创 HDOJ 1166 敌兵布阵(树状数组)
敌兵布阵Problem DescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人
2016-08-14 22:26:59 309
转载 POJ 3321 Apple Tree(DFS + 树状数组)
Apple TreeDescriptionThere is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the
2016-08-13 23:02:51 589
原创 CSUOJ 1726 你经历过绝望吗?两次!(BFS + 优先队列)
1726: 你经历过绝望吗?两次!Description4月16日,日本熊本地区强震后,受灾严重的阿苏市一养猪场倒塌,幸运的是,猪圈里很多头猪依然坚强存活。当地15名消防员耗时一天解救围困的“猪坚强”。不过与在废墟中靠吃木炭饮雨水存活36天的中国汶川“猪坚强”相比,熊本的猪可没那么幸运,因为它们最终还是没能逃过被送往屠宰场的命运。我们假设“猪坚强”被困在一个N*M的
2016-08-13 16:41:40 831
原创 CodeForces 706B Interesting drink(树状数组)
B. Interesting drinkVasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he loves the famous drink "Beecola", which can be bought
2016-08-13 14:48:11 576
原创 POJ 2155 Matrix(二维树状数组)
MatrixDescriptionGiven an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 We can change the m
2016-08-12 22:09:58 396
原创 POJ 1195 Mobile phones(二维树状数组)
Mobile phonesDescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S ma
2016-08-12 17:27:53 320
原创 HDOJ 1272 小希的迷宫(并查集)
小希的迷宫Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一
2016-08-11 21:30:51 267
原创 HDOJ 1198 Farm Irrigation(并查集)
Farm IrrigationProblem DescriptionBenny has a spacious farm land to irrigate. The farm land is a rectangle, and is divided into a lot of samll squares. Water pipes are placed in these sq
2016-08-11 00:02:57 316
原创 POJ 2492 A Bug's Life(并查集)
A Bug's LifeDescriptionBackground Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they feature two different genders and that they only int
2016-08-10 21:02:43 270
原创 POJ 1611 The Suspects(并查集)
The SuspectsDescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission t
2016-08-10 20:49:08 238
原创 HDOJ 1558 Segment set(并查集 + 线段判交)
Segment setProblem DescriptionA segment and all segments which are connected with it compose a segment set. The size of a segment set is the number of segments in it. The problem is to f
2016-08-10 20:41:32 368
原创 HDOJ 3172 Virtual Friends(并查集 + STL)
Virtual FriendsProblem DescriptionThese days, you can do all sorts of things online. For example, you can use various websites to make virtual friends. For some people, growing their soc
2016-08-10 20:32:29 299
原创 HDOJ 1213 How Many Tables(并查集)
How Many TablesProblem DescriptionToday is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to noti
2016-08-09 21:45:57 300
原创 LightOJ 1265 Island of Survival(概率DP)
1265 - Island of SurvivalYou are in a reality show, and the show is way too real that they threw into an island. Only two kinds of animals are in the island, the tigers and the deer. Though un
2016-08-09 15:02:38 478
原创 HDOJ 3068 最长回文(Manacher)
最长回文Problem Description给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等 Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S两组case之间由空行隔开(该空行不用处理)字符串长度l
2016-08-09 00:10:28 269
原创 HDOJ 1429 胜利大逃亡(续)(BFS + 状态压缩)
胜利大逃亡(续)Problem DescriptionIgnatius再次被魔王抓走了(搞不懂他咋这么讨魔王喜欢)……这次魔王汲取了上次的教训,把Ignatius关在一个n*m的地牢里,并在地牢的某些地方安装了带锁的门,钥匙藏在地牢另外的某些地方。刚开始Ignatius被关在(sx,sy)的位置,离开地牢的门在(ex,ey)的位置。Ignatius每分钟只能从一
2016-08-07 23:24:10 936 5
原创 HDOJ 1253 胜利大逃亡(三维BFS)
胜利大逃亡Problem DescriptionIgnatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每
2016-08-07 21:48:17 288
原创 POJ 3974 Palindrome(Manacher)
PalindromeDescriptionAndy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an efficient algori
2016-08-07 17:28:03 569 1
原创 POJ 2752 Seek the Name, Seek the Fame(KMP)
Seek the Name, Seek the FameDescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babie
2016-08-07 15:46:26 266
原创 HDOJ 1240 Asteroids!(三维BFS)
Asteroids!Problem DescriptionYou're in space.You want to get home.There are asteroids.You don't want to hit them. InputInput to this problem will consist of a (non-
2016-08-06 22:20:56 504
原创 SGU 114 Telecasting station(二分)
114. Telecasting stationEvery city in Berland is situated on Ox axis. The government of the country decided to build new telecasting station. After many experiments Berland scientists came
2016-08-06 21:48:07 428
原创 POJ 3746 Cyclic Nacklace(KMP)
Cyclic NacklaceProblem DescriptionCC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left
2016-08-06 21:40:52 585
原创 POJ 1961 Period(KMP)
PeriodDescriptionFor each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic st
2016-08-05 22:24:32 308
原创 POJ 2406 Power Strings(KMP)
Power StringsDescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as mult
2016-08-05 22:11:03 269
原创 HDOJ 2087 剪花布条(KMP)
剪花布条Problem Description一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种
2016-08-05 21:59:54 312
原创 HDOJ 1841 Find the Shortest Common Superstring(KMP)
Find the Shortest Common SuperstringProblem DescriptionThe shortest common superstring of 2 strings S1 and S2 is a string S with the minimum number of characters which contains both S1 a
2016-08-05 21:53:19 317
原创 HDOJ 5025 Saving Tang Monk(BFS + 优先队列 + 状态压缩)
Saving Tang MonkProblem Description《Journey to the West》(also 《Monkey》) is one of the Four Great Classical Novels of Chinese literature. It was written by Wu Cheng'en during the Ming Dyn
2016-08-04 21:16:30 582
原创 POJ 2243 Knight Moves(BFS || 双向BFS)
Knight MovesDescriptionA friend of you is doing research on the Traveling Knight Problem (TKP) where you are to find the shortest closed tour of knight moves that visits each square of a g
2016-08-03 23:11:23 335
原创 POJ 2229 Sumsets(数位DP)
SumsetsDescriptionFarmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer power of 2. Here are the
2016-08-03 21:07:02 276
原创 CodeForces 148D Bag of mice(概率DP)
D. Bag of miceThe dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while t
2016-08-02 23:20:33 316
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人