
算法小结
文章平均质量分 86
算法学习
正牌东风
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
typedef用法(C++)
转自知乎的一段解释: 作者:知乎用户链接:https://www.zhihu.com/question/29798061/answer/144423125来源:知乎著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 不太想谈#define, 在题主的例子的这种用法里, 它就是个文本替换工具, 预处理器完成的, 无脑替换, 跟word里的replace一模一样, ...转载 2018-12-07 23:57:49 · 380 阅读 · 0 评论 -
引用
1、引用:为对象起另外一个名字。引用一旦初始化,引用将和它的初始化对象绑定在一起,无法重新绑定到另外一个对象,注意引用并非是一个对象(通俗:有一个人叫小明,引用就是为小明取个外号叫二狗)int i=2; //有一个人叫小明int j=&i; // 引用时必须初始化。为小明取个外号叫二狗#include <iostream>using namespace std...原创 2018-12-06 22:27:21 · 307 阅读 · 0 评论 -
A Bug's Life POJ - 2492 (并查集)
A Bug's Life POJ - 2492 Background 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 interact wi...原创 2018-11-25 19:04:17 · 197 阅读 · 0 评论 -
How Many Answers Are Wrong HDU - 3038 (带权并查集)
How Many Answers Are Wrong HDU - 3038TT and FF are ... friends. Uh... very very good friends -________-b FF is a bad boy, he is always wooing TT to play the following game with him. This is a very ...翻译 2018-11-25 16:31:45 · 214 阅读 · 0 评论 -
O - The Troublesome Frog POJ - 1054 (多次剪枝)
In Korea, the naughtiness of the cheonggaeguri, a small frog, is legendary. This is a well-deserved reputation, because the frogs jump through your rice paddy at night, flattening rice plants. In the ...原创 2018-10-27 19:22:22 · 217 阅读 · 0 评论 -
B - Calendar POJ - 2080 (历法)
B - Calendar POJ - 2080 A calendar is a system for measuring time, from hours and minutes, to months and days, and finally to years and centuries. The terms of hour, day, month, year and century a...原创 2018-10-23 21:23:59 · 371 阅读 · 0 评论 -
A - Maya Calendar POJ - 1008 (历法)
A - Maya Calendar POJ - 1008 During his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya calendar. From an old knotted message, professor discovered that the Maya ...原创 2018-10-23 20:09:07 · 269 阅读 · 0 评论 -
P - Towers of Hanoi POJ - 1920
P - Towers of Hanoi POJ - 1920 Surely you have already come across the Towers of Hanoi problem: Wooden disks of different sizes are stacked on three pegs, and initially, all disks are stacked on t...原创 2018-12-19 23:03:28 · 439 阅读 · 0 评论 -
H - Increasing Sequences POJ - 1239 (dp好题)
H - Increasing Sequences POJ - 1239Given a string of digits, insert commas to create a sequence of strictly increasing numbers so as to minimize the magnitude of the last number. For this problem, l...原创 2018-11-19 21:24:14 · 584 阅读 · 0 评论 -
炮兵阵地 POJ - 1185 (状态压缩)
炮兵阵地 POJ - 1185 司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能是平原(用"P"表示),如下图。在每一格平原地形上最多可以布置一支炮兵部队(山地上不能够部署炮兵部队);一支炮兵部队在地图上的攻击范围如图中黑色区域所示: 如果在地图中的灰色所标识的平原上部署一支炮兵部队,则图中...原创 2018-11-04 15:34:44 · 179 阅读 · 0 评论 -
Z - Mondriaan's Dream POJ - 2411 _状态压缩(轮廓线dp)
Z - Mondriaan's Dream POJ - 2411 Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his ...原创 2018-11-04 11:06:52 · 252 阅读 · 0 评论 -
W - Apple Tree POJ - 2486 (树形dp+背包)
W - Apple Tree POJ - 2486 Wshxzt is a lovely girl. She likes apple very much. One day HX takes her to an apple tree. There are N nodes in the tree. Each node has an amount of apples. Wshxzt starts...原创 2018-11-03 13:55:24 · 188 阅读 · 0 评论 -
T - Whac-a-Mole POJ - 3034 (动态规划)
T - Whac-a-Mole POJ - 3034 While visiting a traveling fun fair you suddenly have an urge to break the high score in the Whac-a-Mole game. The goal of the Whac-a-Mole game is to… well… whack moles....原创 2018-10-29 21:50:46 · 339 阅读 · 0 评论 -
S - Spiderman POJ - 1925 (区间动态规划)
S - Spiderman POJ - 1925 Dr. Octopus kidnapped Spiderman's girlfriend M.J. and kept her in the West Tower. Now the hero, Spiderman, has to reach the tower as soon as he can to rescue her, using hi...原创 2018-10-28 12:14:07 · 312 阅读 · 0 评论 -
I - Post Office POJ - 1160 (动态规划)
I - Post Office POJ - 1160 There is a straight highway with villages alongside the highway. The highway is represented as an integer axis, and the position of each village is identified with a sin...原创 2018-10-26 22:00:35 · 357 阅读 · 0 评论 -
G - Brackets Sequence POJ - 1141 (动态规划)
G - Brackets Sequence POJ - 1141 Let us define a regular brackets sequence in the following way: 1. Empty sequence is a regular sequence. 2. If S is a regular sequence, then (S) and [S] are both...原创 2018-10-26 19:31:44 · 230 阅读 · 0 评论 -
E - 滑雪 POJ - 1088 (动态规划)
E - 滑雪 POJ - 1088 Michael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 ...原创 2018-10-25 21:10:35 · 200 阅读 · 0 评论 -
D - To the Max POJ - 1050 (动态规划)
D - To the Max POJ - 1050 Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The su...原创 2018-10-25 19:43:43 · 215 阅读 · 0 评论 -
C - A decorative fence POJ - 1037 (动态规划)
C - A decorative fence POJ - 1037 Richard just finished building his new house. Now the only thing the house misses is a cute little wooden fence. He had no idea how to make a wooden fence, so he ...原创 2018-10-24 23:07:32 · 514 阅读 · 0 评论 -
I - Color Tunnels POJ - 1685 (动态规划)
I - Color Tunnels POJ - 1685 A company producing toys has a complex system to paint its products. To obtain the desired color, the product must be painted by several colors in a specified order. A...原创 2018-10-19 22:09:26 · 617 阅读 · 1 评论 -
Q - Castle Walls POJ - 1794 (求逆序对)
Q - Castle Walls POJ - 1794 Background In medieval times, knights commanded big armies of peasants. When they had to storm a castle they would line up neatly in front of the castle's wall and thr...原创 2018-10-22 22:10:19 · 218 阅读 · 0 评论 -
P - Grandpa's Estate POJ - 1228 (凸包)
P - Grandpa's Estate POJ - 1228 Being the only living descendant of his grandfather, Kamran the Believer inherited all of the grandpa's belongings. The most valuable one was a piece of convex poly...原创 2018-10-22 19:32:15 · 190 阅读 · 0 评论 -
M - Hypertransmission POJ - 1901 (距离扫描)
M - Hypertransmission POJ - 1901 The president of the Galactic Federation has recently decided that all planets of the galaxy must establish hyper-radio centers to broadcast their programs. To en...原创 2018-10-21 11:10:42 · 198 阅读 · 0 评论 -
L - The Fortified Forest POJ - 1873 (凸包+枚举)
L - The Fortified Forest POJ - 1873 Once upon a time, in a faraway land, there lived a king. This king owned a small collection of rare and valuable trees, which had been gathered by his ancestors...原创 2018-10-20 21:48:46 · 213 阅读 · 0 评论 -
G - Cowties POJ - 2137 (用dp解决计算几何问题)
G - Cowties POJ - 2137 N cows (3 <= N <= 100) are eating grass in the middle of a field. So that they don't get lost, Farmer John wants to tie them together in a loop so that cow i is attach...原创 2018-10-16 20:38:07 · 208 阅读 · 0 评论 -
F - Line of Sight POJ - 2074(简单计算几何)
F - Line of Sight POJ - 2074 An architect is very proud of his new home and wants to be sure it can be seen by people passing by his property line along the street. The property contains various t...原创 2018-10-16 15:25:59 · 210 阅读 · 0 评论 -
S - Wall POJ - 1113 (凸包)
S - Wall POJ - 1113 Once upon a time there was a greedy King who ordered his chief Architect to build a wall around the King's castle. The King was so greedy, that he would not listen to his Archit...原创 2018-10-07 14:57:13 · 189 阅读 · 0 评论 -
Q - A Round Peg in a Ground Hole POJ - 1584 (叉积判凸多边形和叉积求面积问题)
Q - A Round Peg in a Ground Hole POJ - 1584 The DIY Furniture company specializes in assemble-it-yourself furniture kits. Typically, the pieces of wood are attached to one another using a wooden pe...原创 2018-09-27 22:56:09 · 220 阅读 · 0 评论 -
P - Fishnet POJ - 1408 (计算几何,线段相交,叉积)
P - Fishnet POJ - 1408 A fisherman named Etadokah awoke in a very small island. He could see calm, beautiful and blue sea around the island. The previous night he had encountered a terrible storm an...原创 2018-09-24 17:40:48 · 243 阅读 · 0 评论 -
计算几何(多边形面积的计算,线段规范相交模板)
二维平面内线段规范相交的判定摘自 《计算几何》 --谢迪规范相交---两条线段恰有唯一一个不是断点的公共点。可以用解析几何解法1.列直线方程: Ax+By+C=0 判断解的情况 --若无解则平行 --无穷多解,则说明共线 --唯一解 -判断是否分别在两条线段的内部 解析结合解法的问题 1.求解方程需要浮点除法运算 ...转载 2018-09-24 12:38:40 · 1308 阅读 · 0 评论 -
O - Pipe POJ - 1039 (计算几何好题)
The GX Light Pipeline Company started to prepare bent pipes for the new transgalactic light pipeline. During the design phase of the new pipe shape the company ran into the problem of determining how ...原创 2018-09-23 22:46:27 · 265 阅读 · 0 评论 -
B - Code POJ - 1850 (排列组合)
B - Code POJ - 1850 Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a nu...原创 2018-09-03 22:22:28 · 221 阅读 · 0 评论 -
七种排序算法总结(思想+代码+时间复杂度)
第一组(较为简单的排序方法):①直接(或折半)插入排序、②希尔排序、③起泡排序、④简单排序。第二组(较为复杂的排序方法) : ⑤快速排序、⑥堆排序、⑦归并排序下面介绍这七种排序算法的思想和代码实现以及时间复杂度。1 、折半插入排序算法 该算法是在b[1······i-1]有序序列中用折半查找查找第一个比b[i]大的数的下标k,如果没有,则b[1······i]有序,继续下一个...原创 2018-08-05 23:48:20 · 1568 阅读 · 0 评论 -
J - 奔小康赚大钱 HDU - 2255 (二分图带权值匹配模板详解)
J - 奔小康赚大钱 HDU - 2255 (二分图带权值匹配)传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。 这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子。 另一方面,村长和另外的村领导希望得到最大的效益,这样...原创 2018-08-05 23:19:37 · 226 阅读 · 0 评论 -
U - The Lost House POJ - 2057 (树状dp)
U - The Lost House POJ - 2057 One day a snail climbed up to a big tree and finally came to the end of a branch. What a different feeling to look down from such a high place he had never been to be...原创 2018-11-02 17:17:58 · 238 阅读 · 0 评论 -
C - Number Sequence POJ - 1019 (递归)
C - Number Sequence POJ - 1019 A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2...Sk. Each group Sk consists ...原创 2018-09-06 20:53:56 · 270 阅读 · 0 评论 -
T - Buy the Ticket HDU - 1133(卡特兰数拓展)
T - Buy the TicketHDU - 1133 The "Harry Potter and the Goblet of Fire" will be on show in the next few days. As a crazy fan of Harry Potter, you will go to the cinema and have the first sight, won...原创 2018-07-26 18:21:03 · 205 阅读 · 0 评论 -
N皇后问题
N皇后问题Time Limit: 2000/1000ms (Java/Others)Problem Description: 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input:共有若干行,每行一个正整数N≤12,表示棋盘...原创 2018-07-26 16:00:29 · 165 阅读 · 0 评论 -
X - 大明A+B HDU - 1753(大数运算+细节)
X - 大明A+BHDU - 1753 话说,经过了漫长的一个多月,小明已经成长了许多,所以他改了一个名字叫“大明”。这时他已经不是那个只会做100以内加法的那个“小明”了,现在他甚至会任意长度的正小数的加法。现在,给你两个正的小数A和B,你的任务是代表大明计算出A+B的值。Input本题目包含多组测试数据,请处理到文件结束。每一组测试数据在一行里面包含两个长度不大于400的...原创 2018-07-27 10:01:34 · 263 阅读 · 0 评论 -
V - Children’s Queue HDU - 1297
V - Children’s QueueHDU - 1297 There are many students in PHT School. One day, the headmaster whose name is PigHeader wanted all students stand in a line. He prescribed that girl can not be in si...原创 2018-07-26 20:44:49 · 589 阅读 · 0 评论