class Solution {
public boolean divisorGame(int N) {
boolean[] dp = new boolean[N + 1];
// 给你的数是1,你能赢吗
// 给你的数是i,你能赢吗
for (int i = 1; i <= N; ++i) {
for (int x = 1; x < i; ++x) {
if (i % x == 0 && dp[i - x] == false) {
dp[i] = true;
break;
}
}
}
return dp[N];
}
}
leetcode-1025. 除数博弈
猜你喜欢
转载自blog.csdn.net/qq_39370495/article/details/89737152
今日推荐
周排行