#P2727. [USACO3.2] 01串 Stringsobits

[USACO3.2] 01串 Stringsobits

Description

They are sorted and include all NN-bit binary numbers whose number of 11s is at most LL (LNL \leq N).

Your task is to output the ii-th smallest NN-bit binary number that has at most LL ones (it is guaranteed to exist).

Example: In 100101100101, N=6N = 6, and it contains 33 ones.

Input Format

One line with three integers N,L,iN, L, i.

Output Format

Output the ii-th smallest binary number that satisfies the conditions.

5 3 19
10011

Hint

Problem translation from NOCOW.

USACO Training Section 3.2.

Translated by ChatGPT 5