Although this problem is tagged with “binary search” but still I am not able to come up with a solution using it. Please help with the underlying concept (solution and any further analysis also,if possible).

Thanks.

Problem link: http://www.spoj.com/problems/PIE/