AtCoder Regular Contest 127
翻译中…
Problem Statement
翻译中…
Snuke has written on a blackboard every integer from $1$ through $(2^N-1)$, in binary.
翻译中…
Find the $X$-th lexicographically smallest string when seeing the integers on the blackboard as strings.
翻译中…
Here, the input gives $N$ in decimal, but $X$ in binary.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 10^6$$1 \leq X \leq 2^N-1$$X$is in binary.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
X
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
3
101
Output #1
11
The strings written on the blackboard in lexicographical order are `1`, `10`, `100`, `101`, `11`, `110`, `111`. Additionally, we have $X=101(\mathrm{binary})=5(\mathrm{decimal})$. Thus, the answer is `11`.
Input #2
10
10100011
Output #2
1001001111
Input #3
1000000
11111
Output #3
1000000000000000000000000000000
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。