2023-12-27发表2023-12-27更新LeetCode每日一题几秒读完 (大约103个字)0次访问2660. 保龄球游戏的获胜者2660. 保龄球游戏的获胜者 难度: easy 原始链接: https://leetcode.cn/problems/determine-the-winner-of-a-bowling-game 标签: 模拟 解法一: 模拟go1234567891011121314151617181920212223242526func isWinner(player1 []int, player2 []int) int { player1Score := calcScore(player1) player2Score := calcScore(player2) if player1Score == player2Score { return 0 } else if player1Score > player2Score { return 1 } return 2}func calcScore(player []int) int { sum := 0 counter := 0 for _, score := range player { sum += score if counter > 0 { counter-- sum += score } if score == 10 { counter = 2 } } return sum} 2660. 保龄球游戏的获胜者https://wuhunyu.top/leetcode/2023/12/determine-the-winner-of-a-bowling-game/index.html作者wuhunyu发布于2023-12-27更新于2023-12-27许可协议#模拟