随笔分类 - OJ_HDU
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3008题目大意:人有100血和100魔法,每秒增加 t 魔法(不能超过100)。n个技能,每个技能消耗cost[i]魔法值,造成hurt[i]伤害。普通攻击不消耗魔法,每秒1伤害。boss有100血,每秒对人造成q伤害。每秒内,人先攻击,boss后攻击。问最少多少秒杀死boss?Sample Input4 2 2510 520 1030 2876 704 2 2510 520 10 30 2877 700 0 0Sample Output4 My god分析:普通攻击可以看做是魔法消耗为0,伤害为1
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3127题目大意:将一块长x宽y的矩形布料,剪成小的矩形(每个给定的小矩形都对应一个价值),使得所有小矩形产生的价值最大。Sample Input1 2 4 4 2 2 2 3 3 9Sample Output9分析:这题可以可以看做完全背包问题来接。因为:1、每种矩形布可以剪任意多个;2、题目给出的矩形布可以看做背包容量;3、每个矩形布都有一个价值关键在于找到状态转移方程:设dp[i][j]为长为i宽为j的矩形布的最大价值,下面的图一可以看做待剪的布,图二为小布的尺寸对于这个问题可以两种如下剪布方案
阅读全文
摘要:连连看Time Limit: 20000/10000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13730Accepted Submission(s): 3579Problem Description“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意
阅读全文
摘要:Knight MovesTime Limit:2 Seconds Memory Limit:65536 KBA friend of you is doing research on theTraveling Knight Problem (TKP)where you are to find the shortest closed tour of knight moves that visits each square of a given set ofnsquares on a chessboard exactly once. He thinks that the most difficult
阅读全文
摘要:StonesTime Limit: 5000/3000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 591Accepted Submission(s): 339Problem DescriptionBecause of the wrong status of the bicycle, Sempr begin to walk east to west every morning and walk back every evening. Walking may cause a littl
阅读全文
摘要:String CompareTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1931Accepted Submission(s): 472Problem DescriptionMaybe there are 750,000 words in English and some words are prefix of other words, for example: the word "acm" can be treat as
阅读全文
摘要:Sibonacci NumbersTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 706Accepted Submission(s): 242Problem DescriptionAs is known to all, the definition of Fibonacci Numbers is:f(1)=1f(2)=1f(n)=f(n-1)+f(n-2) (n>=3)Now Sempr found another Numbers, he
阅读全文
摘要:CountDescriptionProf. Tigris is the head of an archaeological team who is currently in charge of an excavation in a site of ancient relics.This site contains relics of a village where civilization once flourished. One night, examining a writing record, you find some text meaningful to you. It reads
阅读全文
摘要:Constructing RoadsTime Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uDescriptionThe city of M is a famous shopping city and its open-air shopping malls are extremely attractive. During the tourist seasons, thousands of people crowded into these shopping malls and enjoy the vary-di
阅读全文
摘要:选课时间(题目已修改,注意读题)Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1865Accepted Submission(s): 1501Problem Description又到了选课的时间了,xhd看着选课表发呆,为了想让下一学期好过点,他想知道学n个学分共有多少组合。你来帮帮他吧。(xhd认为一样学分的课没区别)Input输入数据的第一行是一个数据T,表示有T组数据。每组数据的第一行是两个整数n(1 #include #includ
阅读全文
摘要:Sum of divisorsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 416Accepted Submission(s): 173Problem Descriptionmmm is learning division, she's so proud of herself that she can figure out the sum of all the divisors of numbers no larger than 10
阅读全文