Codeforces #564div2 E1(记忆化搜索)】的更多相关文章

传送门: http://codeforces.com/problemset/problem/607/B Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones in the line as q…
Spiral Maximum 题目连接: http://codeforces.com/problemset/problem/173/C Description Let's consider a k × k square, divided into unit squares. Please note that k ≥ 3 and is odd. We'll paint squares starting from the upper left square in the following orde…
Voracious Steve 题目连接: http://codeforces.com/gym/100231/attachments Description 有两个人在玩一个游戏 有一个盆子里面有n个甜甜圈,A先开始,他可以抓[1,min(m,n)]颗甜甜圈,然后B开始,同样,可以抓[1,min(n,m)]个甜甜圈 谁抓完的,就可以把自己抓的吃完,然后另外一个人就把他的甜甜圈扔进去,然后由失败的那个人开始 问你第一个人最多能吃到多少个甜甜圈 Input 2个整数 n,m 表示一开始有n个甜甜圈,…
D. Zuma 题目连接: http://www.codeforces.com/contest/608/problem/D Description Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gems…
E. Chocolate Bar Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/problem/E Description You have a rectangular chocolate bar consisting of n × m single squares. You want to eat exactly k squares, so you may need to break…
题目:http://codeforces.com/contest/398/problem/B 有点似曾相识的感觉,记忆中上次那个跟这个相似的 我是用了 暴力搜索过掉的,今天这个肯定不行了,dp方程想了非常久也没有想出来,有点无从下手的感觉,最后还是尝试了一下记忆化搜索,以dp[0][0]为边界,dp[x][y]代表当前有x行y列没有彩色的 瓷砖,搜索起来思路还是非常清晰的,可惜最后那个 算期望公式给写错了,瞎了好久,做出以后看了一下别人的做法,确实有点难想到,把涂好的都放在右下角,这样就仅仅有四…
A. Berzerk 题目连接: http://codeforces.com/contest/786/problem/A Description Rick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space, so they play it with a computer…
Palindromic characteristics of string s with length |s| is a sequence of |s| integers, where k-th number is the total number of non-empty substrings of s which are k-palindromes. A string is 1-palindrome if and only if it reads the same backward as f…
题目链接:http://codeforces.com/problemset/problem/148/D 题意: 一个袋子中有w只白老鼠,b只黑老鼠. 公主和龙轮流从袋子里随机抓一只老鼠出来,不放回,公主先拿. 公主每次抓一只出来.龙每次在抓一只出来之后,会随机有一只老鼠跳出来(被龙吓的了...). 先抓到白老鼠的人赢.若两人最后都没有抓到白老鼠,则龙赢. 问你公主赢的概率. 题解: 表示状态: dp[i][j] = probability to win(当前公主先手,公主赢的概率) i:剩i只白…
题目链接:http://codeforces.com/contest/284/problem/D 题意:给出n个数,奇数次操作x,y都加上a[x],偶数次操作y加上a[x],x减去a[x],走出了范围就结束. 问结束时的y值,如果无法结束,那么输出-1 题解:很显然可以用记忆化搜索来解决,可以设dp[i][j](i=0表示偶数次操作以j为结尾的y值是多少,i=1表示奇数次操作以j为结尾的y值是多少) 在加一个辅助的vis[i][j](i=0表示偶数次操作以j为结尾有没有取过,i=1表示奇数次操作…