假设有n个人,则第m个人出局后,从第m+1个人开始重新计数,所以m+1映射成0.得到函数:n = 1:f = 0n > 1: f(n,m) = (f(n-1,m) + m) %n class Solution: def LastRemaining_Solution(self, n, m): # write code here if n < 1 or m < 1: return -1 last = 0 for i in range(2,n+1): last ...