只能说简单题重拳出击了
class Solution:
def isWinner(self, player1: List[int], player2: List[int]) -> int:
if len(player1) == 1:
return 1 if player1[0] > player2[0] else 2 if player2[0] > player1[0] else 0
p1 = sum([player1[i] if player1[i - 1] < 10 and player1[i - 2] < 10 else player1[i]*2 for i in range(2, len(player1))])\
+ (player1[1] if player1[0] < 10 else player1[1]*2) + player1[0]
p2 = sum([player2[i] if player2[i - 1] < 10 and player2[i - 2] < 10 else player2[i]*2 for i in range(2, len(player2))])\
+ (player2[1] if player2[0] < 10 else player2[1]*2) + player2[0]
return 1 if p1 > p2 else 2 if p2 > p1 else 0