题目描述
一次只能从非空的两堆里拿。当存在 两个或更多 的空堆时,游戏停止。
样例
def maximumScore(self, a: int, b: int, c: int) -> int:
x = [a, b, c]
ans = 0
while sorted(x)[1] > 0: ## 既然一次只能同时拿2个,那么 我们就每次循环排序,然后拿最上面的两堆。
x = sorted(x) ## 根据题意(一共3堆),拿最上面两堆,并且判断第二多的那一堆即可。
x[2] -= 1
x[1] -= 1
ans += 1
return ans