LeetCode --- 1025. Divisor Game 解题报告
Posted 杨鑫newlfe
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode --- 1025. Divisor Game 解题报告相关的知识,希望对你有一定的参考价值。
Alice and Bob take turns playing a game, with Alice starting first.
Initially, there is a number n
on the chalkboard. On each player\'s turn, that player makes a move consisting of:
- Choosing any
x
with0 < x < n
andn % x == 0
. - Replacing the number
n
on the chalkboard withn - x
.
Also, if a player cannot make a move, they lose the game.
Return true
if and only if Alice wins the game, assuming both players play optimally.
Example 1:
Input: n = 2 Output: true Explanation: Alice chooses 1, and Bob has no more moves.
Example 2:
Input: n = 3 Output: false Explanation: Alice chooses 1, Bob chooses 1, and Alice has no more moves.
以上是关于LeetCode --- 1025. Divisor Game 解题报告的主要内容,如果未能解决你的问题,请参考以下文章
LeetCode --- 1025. Divisor Game 解题报告
Leetcode之动态规划(DP)专题-1025. 除数博弈(Divisor Game)