
HDUOJ
文章平均质量分 75
努力过
喜欢coding
展开
-
HDU 3722 Card Game 【KM】
Jimmy invents an interesting card game. There are N cards, each of which contains a string Si. Jimmy wants to stick them into several circles, and each card belongs to one circle exactly. When stick...原创 2018-05-16 16:45:15 · 398 阅读 · 0 评论 -
hdu 1867 A + B for you again【KMP】【判断前后缀】
Generally speaking, there are a lot of problems about strings processing. Now you encounter another such problem. If you get two strings, such as “asdf” and “sdfg”, the result of the addition betwee...原创 2018-05-15 11:28:32 · 221 阅读 · 0 评论 -
hdu 3371 Connect the cities【最小生成树】
In 2100, since the sea level rise, most of the cities disappear. Though some survived cities are still connected with others, but most of them become disconnected. The government wants to build some...原创 2018-05-14 20:57:56 · 177 阅读 · 0 评论 -
HDU 5115 M - Dire Wolf 【区间dp】
Dire wolves, also known as Dark wolves, are extraordinarily large and powerful wolves. Many, if not all, Dire Wolves appear to originate from Draenor. Dire wolves look like normal wolves, but thes...原创 2018-05-11 00:18:47 · 170 阅读 · 0 评论 -
hdu 1874 C - 畅通工程续 【spfa + 邻接表】
某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。 现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input 本题目包含多组数据,请处理到文件结束。 每组数据第一行包含两个正整数N和M(...原创 2018-05-04 20:51:10 · 256 阅读 · 0 评论 -
hdu 1160 FatMouse's Speed 【lis+记录路径】
FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of this data as possible into a sequence原创 2018-01-05 11:32:35 · 283 阅读 · 0 评论 -
hdu 1176 免费馅饼 【dp】
都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在小径上接。由于gameboy平时老呆在房间里玩游戏,虽然在游戏中是个身手敏捷的高手,但在现实中运动神经特别迟钝原创 2018-01-03 13:17:52 · 251 阅读 · 0 评论 -
hdu 2364 Escape【模拟优先队列】【bfs】
EscapeTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1182 Accepted Submission(s): 500Problem DescriptionYou find yourself trappe原创 2017-11-12 12:01:45 · 225 阅读 · 0 评论 -
hdu 3336 Count the string【kmp】
Count the stringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11717 Accepted Submission(s): 5461Problem DescriptionIt is well k原创 2017-11-07 19:26:36 · 196 阅读 · 0 评论 -
hdu2087剪花布条+hdu3746Cyclic Nacklace 【kmp复习】
剪花布条Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 22868 Accepted Submission(s): 14289Problem Description一块花布条,里面有些图案,另有一块直接可用的小原创 2017-11-02 10:14:16 · 197 阅读 · 0 评论 -
hdu1102 Constructing Roads
Constructing RoadsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 24721 Accepted Submission(s): 9528Problem DescriptionThere are原创 2017-10-30 17:47:10 · 225 阅读 · 0 评论 -
hdu 5532【最长非递增子序列 时间复杂度 nlogn】
Almost Sorted ArrayTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 6044 Accepted Submission(s): 1451Problem DescriptionWe a原创 2017-10-12 11:04:09 · 368 阅读 · 0 评论 -
hdu 1950 【最长上升子序列 复杂度nlogn】
Bridging signalsTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3080 Accepted Submission(s): 1945Problem Description'Oh no, t原创 2017-10-10 16:53:30 · 256 阅读 · 0 评论 -
hdu 1242 Rescue【bfs+优先队列(c语言模拟)】
#include#include#includeusing namespace std;#define N 210#define inf 0x3f3f3f3fchar map[N][N];int book[N][N],m,n,si,sj,ans;struct node{ int x,y,time;}q[N*N];int cmp(struct node a,stru原创 2017-09-22 09:54:13 · 425 阅读 · 0 评论 -
hdu 1863 [【最小生成树】+hdu2544【floyed】+hdu1874【dijdtra】~~~~模板复习~~~
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1863#include#includestring.h>#define inf 0x3f3f3f3f#define N 120int book[N],w[N][N],min,dis[N];int main(){ int m,n,i,j,t1,t2,t3,s,e,u,flag原创 2017-09-21 18:20:56 · 224 阅读 · 0 评论 -
hdu 2680 Choose the best route【dijstra+反向建图】
Choose the best routeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15494 Accepted Submission(s): 5027Problem DescriptionOne原创 2017-09-20 23:15:32 · 239 阅读 · 0 评论 -
hdu 2594 Simpsons’ Hidden Talents【kmp】
Simpsons’ Hidden TalentsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10278 Accepted Submission(s): 3579Problem Description原创 2017-09-20 10:02:44 · 251 阅读 · 0 评论 -
hdu 1864 最大报销额【01背包变形~】(实数转整型)
最大报销额Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 27158 Accepted Submission(s): 8335Problem Description现有一笔经费可以报销一定额度的发票。允原创 2017-09-19 16:32:24 · 412 阅读 · 0 评论 -
hdu2571命运 【dp】
命运Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 20491 Accepted Submission(s): 7133Problem Description穿过幽谷意味着离大魔王lemon已经无限接近原创 2017-09-19 15:31:17 · 304 阅读 · 0 评论 -
hdu2571命运【bfs】
Problem Description穿过幽谷意味着离大魔王lemon已经无限接近了!可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑!可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮帮执着的他吧!命运大迷宫可以看成是一个两维的方格阵列原创 2017-09-19 08:29:43 · 402 阅读 · 0 评论 -
hdu 5538 House Building 【矩阵表面积】
House BuildingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1808 Accepted Submission(s): 1138Problem DescriptionHave you原创 2017-09-14 16:54:00 · 372 阅读 · 0 评论 -
hdu 5366 The mook jong 【dp】
The mook jongTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1065 Accepted Submission(s): 702Problem Description Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1413 Accepted Submission(s): 840Problem DescriptionMr. Frog has n sti原创 2017-09-13 09:41:31 · 398 阅读 · 1 评论 -
hdu 4034 【floyed变形】
GraphTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 2485 Accepted Submission(s): 1270Problem DescriptionEveryone knows how t原创 2017-09-12 16:29:11 · 191 阅读 · 0 评论 -
hdu 2553 N皇后问题【dfs】
N皇后问题Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 25886 Accepted Submission(s): 11504Problem Description在N*N的方格棋盘放置了N个皇后,使得它原创 2017-09-11 17:16:38 · 310 阅读 · 0 评论 -
【背包专题】K - WHUgirls hdu3127 【二维完全背包】
There are many pretty girls in Wuhan University, and as we know, every girl loves pretty clothes, so do they. One day some of them got a huge rectangular cloth and they want to cut it into small recta原创 2017-08-28 12:29:04 · 240 阅读 · 0 评论 -
【背包专题】J - Piggy-Bank hdu1114【完全背包】
Before 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). The idea behind is simple原创 2017-08-28 09:33:20 · 229 阅读 · 0 评论 -
【背包专题】H - 钱币兑换问题 hdu1284【完全背包】
在一个国家仅有1分,2分,3分硬币,将钱N兑换成硬币有很多种兑法。请你编程序计算出共有多少种兑法。Input每行只有一个正整数N,N小于32768。Output对应每个输入,输出兑换方法数。Sample Input293412553Sample Output71883113137761思路:完全背包来解决这道题。先递推出只兑换1分硬币时的兑换方法有多少种,再递推出加原创 2017-08-27 13:03:41 · 349 阅读 · 0 评论 -
【背包专题】C - The trouble of Xiaoqian hdu3591【混合背包:多重背包+完全背包】
In the country of ALPC , Xiaoqian is a very famous mathematician. She is immersed in calculate, and she want to use the minimum number of coins in every shopping. (The numbers of the shopping include原创 2017-08-27 11:11:57 · 247 阅读 · 0 评论 -
【背包专题】G - Dividing hdu 1059【多重背包】
Marsha 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 marbles had the same v原创 2017-08-26 15:21:19 · 255 阅读 · 0 评论 -
【背包专题】I - 湫湫系列故事——减肥记I hdu4508【完全背包】
对于吃货来说,过年最幸福的事就是吃了,没有之一! 但是对于女生来说,卡路里(热量)是天敌啊! 资深美女湫湫深谙“胖来如山倒,胖去如抽丝”的道理,所以她希望你能帮忙制定一个食谱,能使她吃得开心的同时,不会制造太多的天敌。 当然,为了方便你制作食谱,湫湫给了你每日食物清单,上面描述了当天她想吃的每种食物能带给她的幸福程度,以及会增加的卡路里量。Input 输入包含原创 2017-08-26 14:30:13 · 236 阅读 · 0 评论 -
【背包专题】F - Ahui Writes Word hdu3732【01背包+二进制优化】
We all know that English is very important, so Ahui strive for this in order to learn more English words. To know that word has its value and complexity of writing (the length of each word does not ex原创 2017-08-26 11:49:32 · 213 阅读 · 0 评论 -
【背包专题】 D - Coins hdu2844【多重背包】
Whuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided to buy a very nice watch in a nearby shop. He wante原创 2017-08-25 20:59:47 · 360 阅读 · 0 评论 -
【背包专题】D - Coins hdu 2844 【01背包+二进制优化】
Whuacmers use coins.They have coins of value A1,A2,A3...An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided to buy a very nice watch in a nearby shop. He wante原创 2017-08-25 16:57:05 · 421 阅读 · 0 评论 -
【背包专题】B - FATE hdu2159【二维完全背包】
最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当忍耐度降到0或者0以下时,xhd就不会玩这游戏。xhd还说了他最多只杀s只怪。请问他能升掉这最后一级吗?I原创 2017-08-25 09:11:29 · 184 阅读 · 0 评论 -
【背包专题】A - Bone Collector II hdu2639 【01背包的第k个最优解】
The title of this problem is familiar,isn't it?yeah,if you had took part in the "Rookie Cup" competition,you must have seem this title.If you haven't seen it before,it doesn't matter,I will give you a原创 2017-08-24 11:37:56 · 240 阅读 · 0 评论 -
【背包专题】E - 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活 hdu2191【多重背包】
急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。 请问:你用有限的资金最多能采购多少公斤粮食呢? 后记: 人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。 月有阴晴圆缺,人有旦夕祸福,未来对于我们而言原创 2017-08-23 20:25:58 · 218 阅读 · 0 评论 -
【练习赛补题】问题 D: 最短路径问题 hdu3790【dfs】
题目描述 给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。输入输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s,终点t。n和m为0时输入结束。(1原创 2017-08-21 16:20:11 · 266 阅读 · 0 评论 -
【并查集入门专题1】A+B+D 三道模板题 hdu1232 hdu1233 poj2524【并查集模板】
~~~~连续三道水题,也只能用提高手速这样理由来安慰自己了,不过,从d题数组超限自己改为边存边合并的方法看来还是有收获吧,只能这样强行“收获了”(泪目)某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?原创 2017-08-15 22:02:45 · 295 阅读 · 0 评论 -
【并查集入门专题1】F - How Many Tables hdu1213【并查集水题】
Today 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 notice that not all the friends know each other, a原创 2017-08-15 21:00:17 · 266 阅读 · 0 评论