Open Sesame
CodeChefOpen on judge ↗
In front of you opens a vast library, filled with loads of books from all around the world, guarded by Ali Baba himself! In order to get inside the library, however, you must play a game, which goes as follows. Ali Baba picks out a big book off the shelf, consisting of N pages and hands it to you. He then randomly selects a secret digit from 0 to 9 in his head, and asks you to randomly open the
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start