如果这道题允许借烟?

P1150 Peter 的烟

66xyyd @ 2023-10-05 19:13:16

在 Peter 还剩下 k-1 个烟时可以借一支烟,吸完后再还回去。这样有 O(1) 解法吗?


by ZJLmath @ 2023-10-05 19:17:28

@66xyyd

n+(n-1)/(k-1)


by ZJLmath @ 2023-10-05 19:18:10

@66xyyd

link


by VividCycle @ 2023-10-05 19:19:26

@ZJLmath ?


by gfgoodluck @ 2023-10-05 19:26:19

特判一下应该可以?


by time_Amun @ 2023-10-10 19:07:22

6


|