
HDU
文章平均质量分 73
xuanweiace
一个热爱算法竞赛的弱校ACMer路过。青大本,浙大硕,方向后端开发,菜鸡一枚,奋斗ing...
展开
-
【HDU - 6662】Acesrc and Travel(树形dp,博弈dp)
题干:Acesrc is a famous tourist at Nanjing University second to none. During this summer holiday, he, along with Zhang and Liu, is going to travel to Hong Kong. There arennspots in Hong Kong, andn−1...原创 2019-11-03 16:12:23 · 437 阅读 · 0 评论 -
【HDU - 5012】Dice(模拟,bfs)
题干:There are 2 special dices on the table. On each face of the dice, a distinct number was written. Consider a1.a2,a3,a4,a5,a6to be numbers written on top face, bottom face, left face, right ...原创 2019-11-02 16:01:06 · 226 阅读 · 0 评论 -
【HDU - 5009】Paint Pearls(dp,链表优化dp)
题干:Lee has a string of n pearls. In the beginning, all the pearls have no color. He plans to color the pearls to make it more fascinating. He drew his ideal pattern of the string on a paper and asks...原创 2019-10-31 21:05:28 · 243 阅读 · 0 评论 -
【HDU - 6081】度度熊的王国战略(SW算法,全局最小割)
题干: Problem Description 度度熊国王率领着喵哈哈族的勇士,准备进攻哗啦啦族。 哗啦啦族是一个强悍的民族,里面有充满智慧的谋士,拥有无穷力量的战士。 所以这一场战争,将会十分艰难。 为了更好的进攻哗啦啦族,度度熊决定首先应该从内部瓦解哗啦啦族。 第一步就是应该使得哗啦啦族内部不能同心齐力,需要内部有间隙。 哗啦啦族一共有n个将领,...原创 2019-10-31 21:02:46 · 258 阅读 · 0 评论 -
【HDU - 3002】King of Destruction(无向图全局最小割,SW算法,模板题)
题干:Zhou xingxing is the successor of one style of kung fu called "Karate Kid".he is falling love with a beautiful judo student,after being humiliated by her boyfriend,a Taekwando master from Japan,Z...原创 2019-10-31 21:02:26 · 271 阅读 · 0 评论 -
【HDU - 5017】Ellipsoid(爬山算法,模拟退火,三分)
题干:Given a 3-dimension ellipsoid(椭球面)your task is to find the minimal distance between the original point (0,0,0) and points on the ellipsoid. The distance between two points (x1,y1,z1) and ...原创 2020-12-20 12:47:21 · 259 阅读 · 0 评论 -
【HDU - 5977】Garden of Eden(树分治)
题干:When God made the first man, he put him on a beautiful garden, the Garden of Eden. Here Adam lived with all animals. God gave Adam eternal life. But Adam was lonely in the garden, so God made Eve...原创 2019-10-31 21:01:30 · 330 阅读 · 0 评论 -
【HDU - 5988】Coding Contest(网络流费用流,改模板)
题干:A coding contest will be held in this university, in a huge playground. The whole playground would be divided into N blocks, and there would be M directed paths linking these blocks. The i-th pat...原创 2019-10-31 21:04:27 · 292 阅读 · 0 评论 -
*【HDU - 1506】【POJ - 2559】Largest Rectangle in a Histogram(单调栈或动态规划)
题干: DescriptionA histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figu...原创 2018-07-16 23:44:49 · 235 阅读 · 0 评论 -
【HDU - 1863】 畅通工程(并查集+最小生成树)
题干:省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。 Input测试输入包含若干测试用例。每个测试用例的第1行给出评估的道路条数 N、村庄数目M ( < 100 );随后的 N 行对应村庄间...原创 2018-07-16 23:44:16 · 219 阅读 · 0 评论 -
【HDU - 1301】Jungle Roads(并查集+最小生成树)(内附最小生成树两种算法 克鲁斯特尔算法&&普里姆算法)
题干:Jungle RoadsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5505 Accepted Submission(s): 3976Problem DescriptionThe Head Elder of...原创 2018-07-16 23:44:30 · 227 阅读 · 0 评论 -
*【HDU - 2473】Junk-Mail Filter (并查集--删点操作)
题干:Recognizing junk mails is a tough task. The method used here consists of two steps: 1) Extract the common characteristics from the incoming email. 2) Use a filter matching the set of common cha...原创 2018-07-16 23:43:33 · 400 阅读 · 0 评论 -
【HDU - 1263】 水果(STL)
题干:夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了. Input第一行正整数N(0<N<=10)表示有N组测试数据. 每组测试数据的第一行是一个整数M(0<M<=100),表示工有M次成功的交易.其后有M...原创 2018-07-30 00:18:50 · 286 阅读 · 0 评论 -
HDU 3785 寻找大富翁(sort排序或优先队列)
题干: 浙江桐乡乌镇共有n个人,请找出该镇上的前m个大富翁.Input输入包含多组测试用例. 每个用例首先包含2个整数n(0<n<=100000)和m(0<m<=10),其中: n为镇上的人数,m为需要找出的大富翁数, 接下来一行输入镇上n个人的财富值. n和m同时为0时表示输入结束.Output请输出乌镇前m个大富翁的财产数,财产多的排前面,如果大富翁不足...原创 2018-07-11 10:27:57 · 377 阅读 · 0 评论 -
【HDU - 1031 】Design T-Shirt(水题 排序)
题干:Soon after he decided to design a T-shirt for our Algorithm Board on Free-City BBS, XKA found that he was trapped by all kinds of suggestions from everyone on the board. It is indeed a mission-impo...原创 2018-07-13 00:05:12 · 382 阅读 · 0 评论 -
【HDU - 4355】 Party All the Time(三分)
Party All the TimeTime Limit: 6000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2961 Accepted Submission(s): 939 Problem DescriptionIn the Dark for...原创 2018-07-30 00:18:27 · 481 阅读 · 0 评论 -
【HDU - 3410 】 Passing the Message(单调栈)
题干:What a sunny day! Let’s go picnic and have barbecue! Today, all kids in “Sun Flower” kindergarten are prepared to have an excursion. Before kicking off, teacher Liu tells them to stand in a row. ...原创 2018-07-24 16:52:18 · 299 阅读 · 0 评论 -
【HDU - 1452】 Happy 2004(因子和,逆元,快速幂)
题干: Happy 2004Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1863 Accepted Submission(s): 1361 ...原创 2018-07-24 23:57:47 · 338 阅读 · 0 评论 -
【HDU - 1852】 Beijing 2008()
题干:Beijing 2008Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/65535 K (Java/Others)Total Submission(s): 917 Accepted Submission(s): 394 Problem DescriptionAs we all know, t...原创 2018-07-25 00:01:23 · 261 阅读 · 0 评论 -
【HDU - 2104】hide handkerchief (素数)
题干:The Children’s Day has passed for some days .Has you remembered something happened at your childhood? I remembered I often played a game called hide handkerchief with my friends. Now I introduce...原创 2018-07-25 00:23:11 · 287 阅读 · 0 评论 -
【HDU - 2203】 亲和串 (思维题,可选KMP)
题干:Problem Description人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判断了,但是发现,现在长大了却不知道怎么去判断亲和串了,于是他只好又再一次来请教聪明且乐于助人的你来解决这个问题。亲和串的定义是这样的:给定两个字符串s1和s2,如果能通过s1循环移位,使s2包含在s1中,那么我...原创 2018-07-13 17:59:17 · 224 阅读 · 0 评论 -
【HDU - 3172】Virtual Friends(带权并查集--权为集合元素个数)
题干:These 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 social network (their friends, their friends' ...原创 2018-07-20 08:34:23 · 278 阅读 · 0 评论 -
【HDU - 3038】How Many Answers Are Wrong (带权并查集--权为区间和)
题干:()TT 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 humdrum game. To begin with, TT ...原创 2018-07-20 08:37:59 · 301 阅读 · 0 评论 -
【HDU - 4509】湫湫系列故事——减肥记II(合并区间模板 or 离散化标记 or 线段树)
题干:虽然制定了减肥食谱,但是湫湫显然克制不住吃货的本能,根本没有按照食谱行动! 于是,结果显而易见… 但是没有什么能难倒高智商美女湫湫的,她决定另寻对策——吃没关系,咱吃进去再运动运动消耗掉不就好了? 湫湫在内心咆哮:“我真是天才啊~\(≧▽≦)/~” 可是,大家要知道,过年回家多忙啊——帮忙家里做大扫除,看电影,看小说,高中同学聚餐,初中同学聚餐,小学同学聚餐,吃东西,睡觉,吃东西...原创 2018-07-14 15:59:52 · 255 阅读 · 0 评论 -
【HDU - 2093】 考试排名(排序+格式输出)
题干:C++编程考试使用的实时提交系统,具有即时获得成绩排名的特点。它的功能是怎么实现的呢? 我们做好了题目的解答,提交之后,要么“AC”,要么错误,不管怎样错法,总是给你记上一笔,表明你曾经有过一次错误提交,因而当你一旦提交该题“AC”后,就要与你算一算帐了,总共该题错误提交了几回。虽然你在题数上,大步地跃上了一个台阶,但是在耗时上要摊上你共花去的时间。特别是,曾经有过的错误提交,每次都要摊上一...原创 2018-07-14 22:45:59 · 421 阅读 · 0 评论 -
【HDU - 2087】 剪花布条(直接模拟 or KMP)
题干:一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则不再进行工作。 Outpu...原创 2018-07-14 22:59:53 · 331 阅读 · 0 评论 -
**【HDU - 1052】 田忌赛马(田忌赛马类贪心或双端队列)(或dp)
U - Tian Ji -- The Horse RacingHere is a famous story in Chinese history."That was about 2300 years ago. General Tian Ji was a high official in the country Qi. He likes to play horse ...转载 2018-07-14 23:01:27 · 325 阅读 · 0 评论 -
*【HDU - 1042 】 N! (大数乘法)
题干:Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N! InputOne N in one line, process to the end of file. OutputFor each N, output N! in one line. Sample Input123Sample...原创 2018-07-26 00:58:19 · 291 阅读 · 0 评论 -
【HDU - 1856】 More is better(并查集)(还需要空间优化。。)
题干:Mr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course there are certain requirements. Mr Wang selected a ro...原创 2018-07-15 23:39:20 · 231 阅读 · 0 评论 -
【HDU - 1326】Box of Bricks(模拟水题)
题干:Little Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. ``Look, I've built a wall!'', he tells his older sister Alice. ``Nah, you...原创 2018-07-15 23:39:27 · 314 阅读 · 0 评论 -
【HDU - 1241】Oil Deposits (连通块问题 属于求大海中的岛屿个数 类似问题)
题干: The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that di...原创 2018-07-15 20:14:36 · 493 阅读 · 0 评论 -
【HDU - 4990】 Reading comprehension (构造+矩阵快速幂)
题干:Read the program below carefully then answer the question. #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include<iostream> #include <cstring> #...原创 2018-07-26 14:08:22 · 227 阅读 · 0 评论 -
【HDU - 5015 】233 Matrix (矩阵快速幂)
题干:In our daily life we often use 233 to express our feelings. Actually, we may say 2333, 23333, or 233333 ... in the same meaning. And here is the question: Suppose we have a matrix called 233 matr...原创 2018-07-26 14:11:13 · 379 阅读 · 0 评论 -
【HDU - 2899】 Strange fuction(二分或三分,求导)
题干:Now, here is a fuction: F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100) Can you find the minimum value when x is between 0 and 100.InputThe first line of the input contains an i...原创 2018-07-26 15:50:49 · 286 阅读 · 0 评论 -
【HDU - 1870】愚人节的礼物(水题模拟 思想类似于栈?)
题干:四月一日快到了,Vayko想了个愚人的好办法——送礼物。嘿嘿,不要想的太好,这礼物可没那么简单,Vayko为了愚人,准备了一堆盒子,其中有一个盒子里面装了礼物。盒子里面可以再放零个或者多个盒子。假设放礼物的盒子里不再放其他盒子。 用()表示一个盒子,B表示礼物,Vayko想让你帮她算出愚人指数,即最少需要拆多少个盒子才能拿到礼物。 Input本题目包含多组测试,请处理到文件结束。 每组测试包...原创 2018-07-15 23:40:48 · 339 阅读 · 0 评论 -
【HDU - 1276】士兵队列训练问题 (报数问题 模拟)
题干:某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从头开始进行一至三报数,凡报到三的出列,剩下的向小序号方向靠拢,继续从头开始进行一至二报数。。。,以后从头开始轮流进行一至二报数、一至三报数直到剩下的人数不超过三人为止。 Input本题有多个测试数据组,第一行为组数N,接着为N行新兵人数,新兵人...原创 2018-07-15 23:40:20 · 879 阅读 · 0 评论 -
【HDU - 1873】 看病要排队(优先队列)
题干:看病要排队这个是地球人都知道的常识。 不过经过细心的0068的观察,他发现了医院里排队还是有讲究的。0068所去的医院有三个医生(汗,这么少)同时看病。而看病的人病情有轻重,所以不能根据简单的先来先服务的原则。所以医院对每种病情规定了10种不同的优先级。级别为10的优先权最高,级别为1的优先权最低。医生在看病时,则会在他的队伍里面选择一个优先权最高的人进行诊治。如果遇到两个优先权一样的病人的...原创 2018-07-15 23:38:57 · 280 阅读 · 0 评论 -
【HDU - 1412】 {A} + {B} (STL + set)
题干:给你两个集合,要求{A} + {B}. 注:同一个集合中不会有两个相同的元素.Input每组输入数据分为三行,第一行有两个数字n,m(0<n,m<=10000),分别表示集合A和集合B的元素个数.后两行分别表示集合A和集合B.每个元素为不超出int范围的整数,每个元素之间有一个空格隔开.Output针对每组数据输出一行数据,表示合并后的集合,要求从小到大输出...原创 2018-07-30 00:05:00 · 175 阅读 · 0 评论 -
【HDU - 5688 】Problem D(STL+map)
题干:度熊所居住的 D 国,是一个完全尊重人权的国度。以至于这个国家的所有人命名自己的名字都非常奇怪。一个人的名字由若干个字符组成,同样的,这些字符的全排列的结果中的每一个字符串,也都是这个人的名字。例如,如果一个人名字是 ACM,那么 AMC, CAM, MAC, MCA, 等也都是这个人的名字。在这个国家中,没有两个名字相同的人。 度熊想统计这个国家的人口数量,请帮助度熊设计一个程序,用...原创 2018-07-30 00:04:20 · 265 阅读 · 0 评论 -
*【HDU - 4006】 The kth great number(优先队列 or 线段树)
题干:Xiao Ming and Xiao Bao are playing a simple Numbers game. In a round Xiao Ming can choose to write down a number, or ask Xiao Bao what the kth great number is. Because the number written by Xiao ...原创 2018-07-30 00:10:12 · 218 阅读 · 0 评论