Starting from an empty string, we want to build a string with letters "x", "y", "z". At each step, one of the following operations is performed:
insert two consecutive identical letters "xx", "yy" or "zz" anywhere into the string;
replace one letter in the string with two consecutive letters, according to the rule: "x"
exchange two consecutive different letters in the string, e.g. "xy"
A string is called neutral if it is possible to produce the string from the empty string after an even number of steps.
Let
For example,
Find the sum of
从一个空串开始,我们希望构造一个仅含字母 'x'、'y'、'z' 的字符串。构造的每一步中,你只能进行如下操作之一:
在这个字符串中的任意处插入两个连续且相同的字符 "xx"、"yy" 或 "zz"。
依照如下规则,把字符串中的一个字符替换成两个连续字符:"x"
交换字符串中两个连续且 不同 的字符。例如:"xy"
若能够从空串开始,经 偶数 次操作后得到某个字符串,则称这个字符串是 中性的。
记
例如
求
点 这个链接 回到源站。
点 这个链接 回到详细版题目目录。