当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4012:Paint on a Wall

题目描述
Annie wants to paint her wall to an expected pattern. The wall can be represented as a 2*n grid and each grid will be painted only one color. Annie has a brush which could paint a rectangular area of the wall at a single step. The paint could be overlap and the newly painted color will replace the older one.
  For a given pattern of the wall, your task is to help Annie find out the minimum possible number of painting steps. You can assume that the wall remains unpainted until Annie paint some colors on it.
输入解释
There are multiple test cases in the input. The first line contains the number of test cases.
  For each test case, the first line contains the only integer n indicating the length of the wall. (1 <= n <= 8)
  Two lines follow, denoting the expected pattern of the wall. The color is represented by a single capital letter.
  See the sample input for further details.
输出解释
For each test case, output only one integer denoting the minimum number of steps.
输入样例
3
3
ABA
CBC
3
BAA
CCB
3
BBB
BAB
输出样例
Case #1: 3
Case #2: 3
Case #3: 2
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4012

最后修改于 2020-10-25T23:09:16+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 65768/65768K(Java/Others)