内卷地狱

2582.Pillow

Edit Me

topic:

2582.Pillow.md

Thought:

math题,Find a rule,npersonal,interval=n-1,The number of cycles in the crowd= time//(n1)time // (n-1),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.0CCBYNCSA