分析
每个人有初始的宝石
然后x给y它宝石的一半
求最后最多宝石和最小宝石的差
ac code
class Solution:
def giveGem(self, gem: List[int], operations: List[List[int]]) -> int:
for op in operations:
x, y = op
give = gem[x] // 2
gem[x] -= give
gem[y] += give
return max(gem) - min(gem)
总结
我爱模拟
简单的那种