Numb
Time limit1sMemory limit512 MB
Build an n-digit binary string whose prefixes all leave distinct remainders mod n and whose whole value is divisible by n.
- Level
Medium6 of 10
- Topics
- Greedy, Math, Number theory, Implementation
- Solved
- No attempts yet
Problem
You are given an even integer . Construct a binary number consisting of binary digits such that is divisible by , and all numbers (the prefixes of in binary notation) for have distinct remainders modulo .
Input
The only line of input contains an integer (, is even).
Output
Print the desired number as a string of binary digits. Leading zeroes are disallowed. If there are several possible answers, print any one of them. It is guaranteed that at least one answer exists under these constraints.