Code: Select all
def ceildiv(a, b):
return -(-a // b)
So -a // b * -b gives the next multiple of b >= a.
Copper Bezel wrote:Spoiler:Including the matryoshka doll zinger at the end. Of course, you get that with The Thirteenth Floor and Inception and all of these things, it's basically obligatory....
Jplus wrote:I have posted an answer too, which is a bit more efficient.