Finally you found the city of Gold. As you are fond of gold, you start collecting them. But there are so much gold that you are getting tired collecti ...
分类:
其他好文 时间:
2017-08-10 18:00:52
阅读次数:
142
http://www.lightoj.com/volume_showproblem.php?problem=1013题目大意:给两个字符串,问最短的满足子串包含给的两个字符串的字符串的最短长度,以及最短长度的字符串的个数。第一个问题就是简单的LCS,两个串长度和减去公共部分。第二个问题要进行记忆话搜... ...
分类:
其他好文 时间:
2017-08-10 01:08:34
阅读次数:
152
题意:有 t 只老虎,d只鹿,还有一个人,每天都要有两个生物碰面,1.老虎和老虎碰面,两只老虎就会同归于尽 2.老虎和人碰面或者和鹿碰面,老虎都会吃掉对方 3.人和鹿碰面,人可以选择杀或者不杀该鹿4.鹿和鹿碰面,没事问人存活下来的概率 析:最后存活肯定是老虎没了,首先可以用概率dp来解决,dp[i] ...
分类:
其他好文 时间:
2017-08-09 19:14:40
阅读次数:
182
Batting Practice After being all out for 58 and 78 in two matches in the most prestigious tournament in the world, the coach of a certain national cri ...
分类:
其他好文 时间:
2017-08-09 16:49:54
阅读次数:
177
题意:给定一个人抢劫每个银行的被抓的概率和该银行的钱数,问你在他在不被抓的情况下,能抢劫的最多数量。 析:01背包,用钱数作背包容量,dp[j] = max(dp[j], dp[j-a[i] * (1.0 - pp[i])),dp[i] 表示不被抓的最大概率,在能抢劫到 i 个钱。 代码如下: ...
分类:
其他好文 时间:
2017-08-09 16:47:29
阅读次数:
119
1289 - LCM from 1 to n Given an integer n, you have to find lcm(1, 2, 3, ..., n) lcm means least common multiple. For example lcm(2, 5, 4) = 20, lcm(3 ...
分类:
其他好文 时间:
2017-08-09 14:25:23
阅读次数:
238
题意:给定一个文本串和 n 个子串,问你子串在文本串出现的次数。 析:很明显的AC自动机,只要把先把子串进行失配处理,然后再去用文本串去匹配,在插入子串时就要标记每个串,注意串可能是相同的,这个我错了两次,最后匹配一次就OK了。 代码如下: ...
分类:
其他好文 时间:
2017-08-04 22:45:48
阅读次数:
246
A palindromic number or numeral palindrome is a 'symmetrical' number like 16461 that remains the same when its digits are reversed. In this problem yo ...
分类:
其他好文 时间:
2017-08-04 13:44:41
阅读次数:
438
题目链接:http://lightoj.com/volume_showproblem.php?problem=1102 题目大意:求n有顺序的划分为k个数的方案数. 分析:显然这个就是一个组合公式,隔板法。可以把问题转化为x1+x2+…..xk = n 这个多元一次方程上。然后这个解就是C(n+k- ...
分类:
其他好文 时间:
2017-07-24 16:24:44
阅读次数:
204
https://vjudge.net/problem/LightOJ-1030 题意: 在一个1×N的格子里,每个格子都有相应的金币数,走到相应格子的话,就会得到该格子的金币。 现在从1格子开始,每次摇骰子,他就前进几步,但有一种情况例外,如果当前位置+色子数 > N,那么他就会重新摇色子。 走到N ...
分类:
其他好文 时间:
2017-07-24 13:28:28
阅读次数:
192