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

建议使用的浏览器:

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

6212:Zuma

题目描述
Think about the Zuma Game. You have a row of at most $200$ black(0) or white(1) balls on the table at the start. Each three consecutive balls never share the same colour. You also have infinite amount of black and white balls in your hand. On each turn, you can choose a ball in your hand and insert it into the row, including the leftmost place and the rightmost place. Then, if there is a group of three of more balls in the same colour touching, remove these balls. Keep doing this until no more balls can be removed.
Find the minimal balls you have to insert to remove all the balls on the table.
输入解释
The first line of input contains an integer $T~(1\le T\le 100)$ which is the total number of test cases.
Each test case contains a line with a non-empty string of $0$ and $1$ describing the row of balls at the start.
输出解释
For each test case, output the case number and the minimal balls required to insert in a line.
输入样例
4
10101
101001001
1001001001
01001101011001100
输出样例
Case #1: 4
Case #2: 3
Case #3: 3
Case #4: 2
来自杭电HDUOJ的附加信息
Recommend liuyiding

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

源链接: HDU-6212

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

共提交 0

通过率 --%
时间上限 内存上限
1000/1000MS(Java/Others) 65535/32768K(Java/Others)