[题目]C. Bear and Company [题意]给定大写字母字符串,交换相邻字符代价为1,求最小代价使得字符串不含"VK"子串.n<=75. [算法]动态规划 [题解]关键在于表示状态,我们将确定下来的前若干个固定作为状态,后面新加的字符不会进入固定的前若干个.(为了方便,非'V''K'的字符皆为‘X') 由于相同字符显然不可能跨越,那么前若干个的有效信息只有:它是由前v个’V',前k个‘K',前x个’X'组成的,最后一个字符是否’V',即f[v][k][x][0/1].…
D. Bear and Tower of Cubes 题目连接: http://www.codeforces.com/contest/680/problem/D Description Limak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive integer length of side. Limak has infinitely many…
[Codeforces]Round #491 (Div. 2) 总结 这次尴尬了,D题fst,E没有做出来.... 不过还好,rating只掉了30,总体来说比较不稳,下次加油 A:If at first you don't succeed- SB题,就是注意一下特判就好了,然后我一开始wa了三次... #include<bits/stdc++.h> using namespace std; int read(){ int ans=0,w=1;char c=getchar(); while(!…
题目链接: D. Bear and Tower of Cubes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Limak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Limak is a little polar bear. He plays by building towers from blocks. Every block is a cube with positive integer length of side. Limak has inf…