QOJ.ac

QOJ

时间限制: 5 s 内存限制: 64 MB 总分: 100

#11163. Board design

统计

A board consists of $n \cdot n$ squares arranged in $n$ rows and $n$ columns, numbered from $1$ to $n$. The square in the $i$-th row and $j$-th column has coordinates $(i, j)$. We want to move from the square in the top-left corner (with coordinates $(1, 1)$) to the square in the bottom-right corner (with coordinates $(n, n)$). Some squares are blocked. We can only move through unblocked squares to the right and down; that is, from square $(i, j)$ we can move to square $(i, j+1)$ or $(i+1, j)$, provided they are not blocked.

Some boards can be traversed in only one way, others in many. Given a number $K$, design a board with dimensions no larger than $100$ for which the number of different paths is exactly $K$.

Input

The first line of input contains a single integer $K$ ($0 \le K$).

Output

In the first line of output, print a single integer $n$ ($1 \le n \le 100$) representing the size of the board. In the next $n$ lines, print $n$-character strings consisting of the characters . (unblocked square) and # (blocked square); the $j$-th character in the $i$-th row should describe the square $(i, j)$.

For the limits given in the problem statement, an answer always exists. If there is more than one, your program may output any of them.

Examples

Input 1

6

Output 1

4
...#
....
##..
###.

Subtasks

The test set is divided into the following subtasks. Tests for each subtask consist of one or more separate test groups.

Subtask Conditions Points
1 $K \le 50$ 15
2 $K \le 2000$ 15
3 $K \le 10^9$ 40
4 $K \le 10^{18}$ 30

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.