- 博客(61)
- 收藏
- 关注
原创 【数位DP】不要62 (入门)
Problem Description杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如:62315 73418 88914都属于不吉利号码。但是,61152虽然含有
2018-01-12 09:11:28
567
原创 【状压DP】 Mondriaan's Dream(入门)
Problem DescriptionSquares 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 toilet paper t
2018-01-10 21:09:50
294
原创 KMP算法总结
KMP算法原理现在假设有两个字符串A:bbc abcdab abcdabde,B:abcdabd。现在要在A中找B。比较暴力的方法是直接搜索:void gosearch(){ int la=strlen(a),lb=strlen(b); for(int i=0;i<la;i++) { int j=0; while(j<lb&&a[i
2017-07-11 15:38:48
195
原创 HDOJ 1257 最少拦截系统(最长递增子序列)
Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹.怎么办呢?多搞几套系统呗!你说说倒蛮容易,成本呢?成本是个大问题啊.所以俺就到这里
2017-07-11 10:06:55
310
原创 HDOJ 1224 Free DIY Tour(DP)
Problem DescriptionWeiwei is a software engineer of ShiningSoft. He has just excellently fulfilled a software project with his fellow workers. His boss is so satisfied with their job that he decid
2017-07-11 09:51:39
254
原创 HDOJ 1203 I NEED A OFFER!(0 1背包)
Problem DescriptionSpeakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了。要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的。Speakless没有多少钱,总共只攒了n万美元。他将在m个学校中选择若干的(当然要在他的经济承受范围内)。每个学校都有不同的申请费用a(万美元),并且Speakless估计了
2017-07-11 09:45:43
345
原创 HDOJ 1176 免费馅饼(DP)
Problem Description都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中
2017-07-11 09:41:45
273
原创 HDOJ 1171 Big Event in HDU(二进制拆分+0 1背包)
Problem DescriptionNowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College had ever been split into Computer College and Softw
2017-07-11 09:34:42
224
原创 HDOJ 1114 Piggy-Bank (DP)
Problem DescriptionBefore ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). Th
2017-07-10 21:13:40
287
原创 HDOJ 1087 Super Jumping! Jumping! Jumping! (DP)
Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to
2017-07-10 21:01:57
268
原创 HDOJ 1078 FatMouse and Cheese (DFS+DP)
Problem DescriptionFatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is labelled (p,q) where 0 <= p < n and 0 <= q < n. At e
2017-07-10 20:52:40
249
原创 HDOJ 1069 Monkey and Banana DP
Problem DescriptionA group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with s
2017-07-10 20:41:04
429
原创 HDOJ 1059 Dividing(多重背包+二进制优化)
Problem DescriptionMarsha and Bill own a collection of marbles. They want to split the collection among themselves so that both receive an equal share of the marbles. This would be easy if all the
2017-07-10 20:14:15
517
1
原创 HDOJ 1508 Humble Numbers
Problem DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the fir
2017-07-10 20:04:07
262
原创 Escape from Stones -DFS
Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval [0, 1]. Next, nstones will fall and Liss will es
2017-07-04 12:29:47
385
原创 Ants -暴力枚举
AntsAn army of ants walk on a horizontal pole of length l cm, each with a constant speed of 1 cm/s. When a walking ant reaches an end of the pole, it immediatelly falls off it. When two ants mee
2017-07-04 11:27:15
308
转载 元素为结构体的vector 找最大元素
/* max_element(col.begin(),col.end())和min_element(col.begin(),col.end())都默认使用less来排序的,复杂度是O(n),返回值都是iterator 但不支持自定义类型,如下程序无法达到目的*/#include #include #include #include using namespace
2017-04-24 22:53:16
1363
转载 STL Map使用详解(一)(包含如何按关键字降序排列)
转自:http://blog.csdn.net/bichenggui/article/details/4215344 Map是一种关联容器,用来存储key-value数据。其中的key是用来查找的关键字,value是实际存放的值。一个特定的关键字只能与一个唯一的值相联系。map是由一对一对的键值(key/value)所组成的排序结构体,键值是读一无二的(unique)的。
2017-04-24 21:44:46
2334
原创 迷宫与宝藏(bfs)(未完成)
迷宫与宝藏Description 机器人要在一个矩形迷宫里行动(不能原地停留,只能走向上/下/左/右),每移动一格花费1个单位时间。迷宫有以下几种元素:【*】 机器人的起点【#】 墙。机器人不能走过这些格子【.】 平地。机器人可以在上面自由行走【0-9】 宝藏。当机器人走到此处会立刻获得该数字相应的宝藏,宝藏不会消失,可以反复获取(但不能停留)若机器人要恰好获得总和为x的宝藏,它最少需
2017-01-15 15:08:40
590
原创 DFS初步:递推,递归
A - 一只小蜜蜂...有一只经过训练的蜜蜂只能爬向右侧相邻的蜂房,不能反向爬行。请编程计算蜜蜂从蜂房a爬到蜂房b的可能路线数。 其中,蜂房的结构如下所示。 Input输入数据的第一行是一个整数N,表示测试实例的个数,然后是N 行数据,每行包含两个整数a和b(0Output对于每个测试实例,请输出蜜蜂从蜂房a爬到蜂房b的可能路线数,每个实例的输出占一行。 Sample I
2017-01-13 19:07:40
876
原创 bfs入门题5道
Red and Black原题:There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent
2017-01-13 18:41:48
473
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人