avatar
Siz Long

My name is Siz. I am a computer science graduate student specializing in backend development with Golang and Python, seeking opportunities in innovative tech projects. My personal website is me.longsizhuo.com .Connect with me on LinkedIn: https://www.linkedin.com/in/longsizhuo/.

  • Resume
  • Archives
  • Categories
  • Photos
  • Music



{{ date }}

{{ time }}

avatar
Siz Long

My name is Siz. I am a computer science graduate student specializing in backend development with Golang and Python, seeking opportunities in innovative tech projects. My personal website is me.longsizhuo.com .Connect with me on LinkedIn: https://www.linkedin.com/in/longsizhuo/.

  • 主页
  • Resume
  • Archives
  • Categories
  • Photos
  • Music

2582.Pillow

  2024-01-01        
字数统计: 82字   |   阅读时长: 1min

topic:

screenshot2023-09-27 morning2.19.52.png

2582.Pillow.md

Thought:

math题,Find a rule,npersonal,interval=n-1,The number of cycles in the crowd= $time // (n-1)$,The number of cycles is2The number of times from scratch,Otherwise, the number of forwards from the back。

screenshot2023-09-27 morning2.24.10.png

Code:

1
2
3
4
5
6
7
8
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)
  • Python
  • answer
  • math
  • simulation

扫一扫,分享到微信

微信分享二维码
2562.Find the series of the array
2591.Child that divides money the most
目录
  1. 1. topic:
  2. 2. Thought:
  3. 3. Code:

150 篇 | 131.7k
次 | 人
这里自动载入天数这里自动载入时分秒
2022-2025 loong loong | 新南威尔士龙龙号