Approximating a Constant Range

CodeForces - 602B