思路:以4为一个分组分别进行处理
class Solution:
def clumsy(self, n: int) -> int:
answer_dict = {0:0,1: 1, 2: 2, 3: 6, 4: 7}
if n > 4:
answer = n * (n - 1) // (n - 2) + n - 3
n -= 4
else:
print(answer_dict[n])
return answer_dict[n]
print(answer)
while n >=4:
current_answer = n * (n - 1) // (n - 2) - n + 3
answer -= current_answer
n -= 4
print(answer,n)
answer-=answer_dict[n]
print(answer)
return answer