No.873 Binary, Yabai-nari! lol
Problem Statement
A binary is defined as "a string consisting only of 0 and 1".
A 01-sequence is defined as "a binary in which adjacent characters are different".
The yabasa of a binary is defined as "the sum of the squares of the lengths of the 01-sequences obtained by splitting the binary at the places where the same character occurs consecutively".
For example, "01011011000" is split into "0101" , "101" , "10" , "0" , "0", and its yabasa is $4^2+3^2+2^2+1^2+1^2=31$.
You are given a positive integer $N$. Find the shortest binary among those whose yabasa is $N$.
If there are multiple answers, find the lexicographically smallest one among them.
Input
$N$
The input is given as an integer.
$1\leq N\leq 3 \times 10^5$
Output
Print a newline at the end.
Sample
Sample 1
Input
1
Output
0
The binaries whose yabasa is 1 are "0" and "1". Both have length 1, and the lexicographically smallest one, "0", is printed.
Sample 2
Input
5
Output
001
Sample 3
Input
32
Output
01011010
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
tatyam