Balanced Illumination
시간 제한1초메모리 제한512 MB
n비트의 순환 그레이 코드를 만들어, 이웃한 조합이 한 비트만 다르고 각 전구가 거의 같은 횟수로 토글되도록 2^n개 조합을 출력한다.
문제
Saint Bitsburg government is preparing a technical requirement for New Year city decoration.
The governor thinks that there should be a garland of lights on the main square. The lights will turn on and off and entertain the residents of Saint Bitsburg.
The chief designer decided that the garland would change its appearance each second. Every light in the garland can be in two states: on and off. Each second exactly one light will change its state from on to off, or from off to on. Also the chief designer wants all combination of lights in the garland to repeat with a period seconds. During the period of seconds all possible lights combinations in the garland have to be presented.
The city's chief engineer, however, noted that frequently turning lights on and off would cause their malfunction. To minimize the chance of the lights malfunction it is required for every light to be turned on and off approximately the same number of times.
So, the final technical requirement for you --- Chief Programmer of the Government Department of Information Technology --- is here.
- You need to make a plan of combinations of lights , where is a line of zeros and ones, means, that the light in the combination is on, means, that the light in the combination is off.
- All combinations in the plan have to be distinct.
- This plan will be launched in a cycle, each second the next combination is presented on the garland, in the -th second the combination is presented.
- Adjacent combinations have to differ in exactly one light's state. Combination and also have to differ in exactly one light's state.
- Let us denote by the number of state changes of the light during a complete cycle, including the final change from to . Then for any values and have to differ by no more than .
Get to work!
입력
Input contains one integer ().
출력
Output lines of characters --- sequence of combinations in the plan. It is guaranteed that a plan satisfying all requirements exists.
힌트
In the first sample test , .
In the second sample test .