USACO 2023 February Contest, Silver Problem 1. Bakery

Hello,

Link to problem: USACO
Link to solution: Contest Results

on this line of code for solution:
lx = max(lx, (-c + b * d + (b - a - 1)) // (b - a))

shouldn’t this be lx = max(lx, (-c + b * d) // (b - a)) ?

How did they derive (b - a - 1)? I’m confused

Thanks

1 Like

Ceiling division: Is there a ceiling equivalent of // operator in Python? - Stack Overflow

1 Like

thanks!
i’ll post my solution with comments so other people know

1 Like