2582.Pillow
topic:
Thought:
math题,Find a rule,npersonal,interval=n-1,The number of cycles in the crowd= ,The number of cycles is2The number of times from scratch,Otherwise, the number of forwards from the back。
Code:
class Solution:
def passThePillow(self, n: int, time: int) -> int:
if n > time:
return time + 1
if time // (n-1) % 2 == 0:
return time % (n-1) + 1
else:
return n - time % (n-1)贡献者
这篇文章有帮助吗?
最近更新
Involution Hell© 2026 byCommunityunderCC BY-NC-SA 4.0