#P1028. 格雷码 (Gray Code)
格雷码 (Gray Code)
Source: CSES Problem Set (Task 2205)
Link: https://cses.fi/problemset/task/2205
Category: Introductory Problems
- Time limit: 1.00 s
- Memory limit: 512 MB
A Gray code is a list of all bit strings of length , where any two successive strings differ in exactly one bit (i.e., their Hamming distance is one).
Your task is to create a Gray code for a given length .
Input
The only input line has an integer .
Output
Print lines that describe the Gray code. You can print any valid solution.
Constraints
Example
Input:
2
Output:
00
01
11
10