Recently, I came upon this problem:↵
↵
Given: A, C, and that ceil(A/B) < C↵
↵
Find: the smallest B possible↵
↵
My solution was using binary search. ↵
However, the official solution came up with this clever closed form formula:↵
↵
~~~~~↵
B = ceil(A/(C-1))↵
~~~~~↵
↵
I'm completely boggled by this equation. I've seen quite a few closed form equations involving floor and ceil before, but I can't find how they are derived.↵
↵
Any help, explanation, or pointers appreciated!
↵
Given: A, C, and that ceil(A/B) < C↵
↵
Find: the smallest B possible↵
↵
My solution was using binary search. ↵
However, the official solution came up with this clever closed form formula:↵
↵
~~~~~↵
B = ceil(A/(C-1))↵
~~~~~↵
↵
I'm completely boggled by this equation. I've seen quite a few closed form equations involving floor and ceil before, but I can't find how they are derived.↵
↵
Any help, explanation, or pointers appreciated!