hdu 2577 How to Type(DP)】的更多相关文章

How to Type Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4658    Accepted Submission(s): 2110 Problem Description Pirates have finished developing the typing software. He called Cathy to tes…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2577 解题报告:有一个长度在100以内的字符串,并且这个字符串只有大写和小写字母组成,现在要把这些字符串用键盘输入到电脑中,一开始的时候大写锁定是关闭的,并且要求结束的时候也是关闭的,然后让你求输入这些字符串最少需要按多少次键盘(包括Cap Lock键和Shift键) 一个典型的dp题,定义一个一维数组就够了,然后dp[i]的含义的输入到第i个字符时需要按键的最少次数.然后递推公式如下: dp[i]…
题目链接 Problem Description Pirates have finished developing the typing software. He called Cathy to test his typing software. She is good at thinking. After testing for several days, she finds that if she types a string by some ways, she will type the…
题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=1864 题目: 最大报销额 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 25248    Accepted Submission(s): 7771 Problem Description 现有一笔经费可以报销一定额度的发票.允许报销的发票类…
题目链接 Problem Description 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 link: Here is the l…
守护雅典娜 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 324    Accepted Submission(s): 91 Problem Description 许多塔防游戏都是以经典的“守护雅典娜”为原型的.玩家需要建立各种防御工具来阻止怪物接近我们的女神——雅典娜. 这里,我们可以建造的防御工具只有标准圆形状的防御墙,建立在雅典…
有n(2e4)个宝石两个人轮流从左侧取宝石,Alice先手,首轮取1个或2个宝石,如果上一轮取了k个宝石,则这一轮只能取k或k+1个宝石.一旦不能再取宝石就结束.双方都希望自己拿到的宝石数比对方尽可能多.问你,先手比后手多拿的最大宝石数. dp[s][k] 表示从已经拿了s个,这一次可以拿k个,也可以拿k+1个. 那么dp[s][k] 表示 已经拿了s个,这一次可以拿k个或k+1个的最大差值. #include <cstdio> #include <cstdlib> #includ…
How to Type Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4616    Accepted Submission(s): 2084 Problem Description Pirates have finished developing the typing software. He called Cathy to tes…
http://acm.hdu.edu.cn/showproblem.php?pid=6357 题意 给一个数值范围为0-9的a数组,可以选择翻转一个区间,问非严格最长上升子序列,以及翻转的区间. 分析 官方题解的做法: 它把最长不下降子序列映射成两个序列的最长公共子序列问题 a序列就是给出的原序列 b序列是值域的序列 需要注意的是:b序列可以重复匹配 一般的最长不下降子序列中,b序列就是:0,1,2,3,4,5,6,7,8,9 这样a和b的最长公共子序列就是一个最长不下降子序列. 然后这题它说可…
题目链接 Problem Description A 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 some blocks. If the monkey is clever enough, it s…