Codeforces936C. Lock Puzzle】的更多相关文章

给个串,只能用操作shift x表示把后面x个字符翻转后放到串的前面.问s串怎么操作能变t串.n<=2000,操作次数<=6100. 打VP时这转来转去的有点晕... 可以想一种逐步构造的方法,即从一个小的完成构造的部分通过一顿操作,在不影响这部分的前提下扩展. 好吧我看题解了,直接丢图,是从abc扩展成xabcy的方法,如果反了就把他最后再倒过来. 操作次数是$\frac{5}{2}n$的,复杂度$kn$,$k$指操作次数. //#include<iostream> #inclu…
http://acm.hdu.edu.cn/showproblem.php?pid=4708 Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Alice was felling into a cave. She found a strange door with a number square m…
Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1836    Accepted Submission(s): 580 Problem Description Alice was felling into a cave. She found a strange door with a numbe…
Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 654 Accepted Submission(s): 190 Problem Description Alice was felling into a cave. She found a strange door with a number squar…
Lock Puzzle 题目大意:给你两个字符串一个s,一个t,长度<=2000,要求你进行小于等于6100次的shift操作,将s变成t, shift(x)表示将字符串的最后x个字符翻转后放到最前面. 思路:不会写,看了题解... 因为长度为3000,操作为6500,我们考虑每三次操作将一个字符放到最后,并保证其他字符的顺序不变,这样是可以实现的, 如果我们想要将第k个字符移到最后,我们只要shift(n-1-k) , shift(1) , shift(n-1),就能实现啦 . #includ…
Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 290    Accepted Submission(s): 60 Problem Description Alice was felling into a cave. She found a strange door with a number s…
Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 695    Accepted Submission(s): 204 Problem Description Alice was felling into a cave. She found a strange door with a number…
Problem Description Alice was felling into a cave. She found a strange door with a number square matrix. These numbers can be rotated around the center clockwise or counterclockwise. A fairy came and told her how to solve this puzzle lock: “When the…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4708 题目大意:给定一个方形矩阵,边长为3-10的奇数.每一圈的数字可以沿着顺时针方向和逆时针方向旋转,求使得矩阵主对角线和反对角线和最大时的数以及需要旋转的最小步骤. Sample Input 5 9 3 2 5 9 7 4 7 5 4 6 9 3 9 3 5 2 8 7 2 9 9 4 1 9 0   Sample Output 72 1 分析:简单的模拟.分别计算每一圈旋转后的四个角的值最大需…
题意:给出一个n*n的矩阵,旋转每一圈数字,求出对角线可能的最大值,以及转到最大时的最小距离. 只要分析每一层就可以了,本来想用地址传递二维数组,发现行不通,改了一下就行了. 这里有个坑,比如: 1 1 9 9 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 很明显最大的就是将一个9转到矩阵角,而这里更新最大值时很容易把另一种情况屏蔽掉,从而错过了更少步骤达到最大值的方法. 代码: /* * Author: illuz <iilluzen[at]gmail.com> * Blo…