Consider a 3×3 grid puzzle made from 24 matchsticks. At first, every matchstick is placed as follows.
+--+--+--+
|..|..|..|
|..|..|..|
+--+--+--+
|..|..|..|
|..|..|..|
+--+--+--+
|..|..|..|
|..|..|..|
+--+--+--+
Two consecutive - characters represent one horizontal matchstick, and two consecutive | characters represent one vertical matchstick. A + marks a point where matchstick endpoints can meet, and . marks empty space.
Initially, the grid contains 14 squares: nine 1×1 squares, four 2×2 squares, and one 3×3 square.
You are given integers N and K. Remove exactly N matchsticks so that all of the following conditions hold.
Write a program that prints one grid satisfying these conditions.
The first line contains integers N and K. (1 ≤ N < 24, 1 ≤ K < 14)
N is the number of matchsticks to remove, and K is the number of squares that must remain.
Print a grid satisfying the conditions in 10 lines.
+ at every point where matchstick endpoints can meet, even if no matchstick touches that point.. at every position where no matchstick is placed.- characters.| characters.Every input is guaranteed to have at least one valid answer. If there are multiple valid grids, you may print any one of them.