小编Jia*_* Li的帖子

"挑选数字游戏"的算法

我很难找到解决办法,但我不知道.

RobotA和RobotB选择N个数字的排列开始.RobotA首先选择,他们交替选择.每转一圈,机器人只能从排列中挑选任何一个剩余的数字.当剩余数字形成递增序列时,游戏结束.选择最后一个回合的机器人(之后序列变得越来越大)赢得了游戏.

假设两者都发挥得最好,谁赢了?

例1:

 The original sequence is 1 7 3. 
 RobotA wins by picking 7, after which the sequence is increasing 1 3.
Run Code Online (Sandbox Code Playgroud)

例2:

 The original sequence is 8 5 3 1 2.
 RobotB wins by selecting the 2, preventing any increasing sequence.
Run Code Online (Sandbox Code Playgroud)

有没有已知的算法来解决这个问题?请给我任何关于在哪里看的提示或想法,真的很感激!

puzzle algorithm permutation

7
推荐指数
1
解决办法
1283
查看次数

标签 统计

algorithm ×1

permutation ×1

puzzle ×1