3222. 求出硬币游戏的赢家
为保证权益,题目请参考 3222. 求出硬币游戏的赢家(From LeetCode).
解决方案1
Python
python
class Solution:
def losingPlayer(self, x: int, y: int) -> str:
a = "Alice"
b = "Bob"
cur_is_a = True
while True:
if not (x >= 1 and y >= 4):
break
cur_is_a = not cur_is_a
x = x - 1
y = y - 4
return b if cur_is_a else a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15