{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003e安妮想要按预期的图案给她的墙涂上颜色。墙可以被表示为一个2*n的网格,每个网格只会被涂上一种颜色。安妮有一把可以一次性涂抹墙壁上矩形区域的刷子。涂抹可以重叠,新涂上的颜色会替换旧的颜色。\u003cbr\u003e\u0026nbsp;\u0026nbsp;对于给定的墙壁图案,你的任务是帮助安妮找出可能的最小涂抹步数。你可以假设墙壁保持未涂抹状态,直到安妮涂上一些颜色。\u003cbr\u003e\u003c/div\u003e"}},{"title":"输入","value":{"format":"HTML","content":"输入中包含多个测试用例。第一行包含测试用例的数量。\u003cbr\u003e\u0026nbsp;\u0026nbsp;对于每个测试用例,第一行包含一个整数n,表示墙壁的长度。(1 \u0026lt;\u003d n \u0026lt;\u003d 8)\u003cbr\u003e\u0026nbsp;\u0026nbsp;接下来两行表示墙壁的预期图案。颜色由一个大写字母表示。\u003cbr\u003e\u0026nbsp;\u0026nbsp;详细信息请参见示例输入。\u003cbr\u003e"}},{"title":"输出","value":{"format":"HTML","content":"对于每个测试用例,输出一个整数,表示最小涂抹步数。"}},{"title":"示例","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\n3\r\nABA\r\nCBC\r\n3\r\nBAA\r\nCCB\r\n3\r\nBBB\r\nBAB\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1: 3\r\nCase #2: 3\r\nCase #3: 2\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e"}}]}