BINSMOD - Editorial

Problem link: Contest Page | CodeChef

Difficulty: Easy

Pre-requisite: None

Quick Explanation: Pre-computation to find all beautiful numbers.

Full Explanation:
For optimal solution we have to pre compute all the beautiful numbers so that during a query we can found the nearest beautiful number greater than or equal to the given number, and this query runs in O(logn) (where n is the given number).