Left and Right play a game with a number of words, each consisting of L's and R's, alternating turns. On Left's turn, for each word, Left can remove any number of letters (possibly zero), but not all the letters, from the left side of the word. However, at least one letter must be removed from at least one word. Right does the same on Right's turn except that Right removes letters from the right side of each word. The game continues until each word is reduced to a single letter. If there are more L's than R's remaining then Left wins; otherwise if there are more R's than L's then Right wins. In this problem we only consider games with an odd number of words, thus making ties impossible.
Let
It can be seen that
You are also given
Find
小左和小右正用若干个只含 L、R 的词玩游戏。两人轮流进行操作。轮到小左操作时,对于每一个词,小左可以删去这个词左侧任意多个(包括 0 个)字符,但不能把该词删空。但是,小左必须要从至少 1 个词中删去至少 1 个字符。小右在他的轮次中,也进行相同的操作,只不过他只能删去一个词右侧若干个(包括 0 个)字符。当每个词都只剩一个字符时,游戏结束。如果 L 的数量多于 R 的数量,则小左获胜;如果 R 的数量多于 L 的数量,则小右获胜。本题中,我们只考虑有奇数个词的情况,所以该游戏不存在平局。
记
下述合法的选择方案(以及它们的重排)表明
亦已知
求
点 这个链接 回到源站。
点 这个链接 回到详细版题目目录。