WC '18 Contest 3 J3 - R

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 16M

Author:
Problem type
Woburn Challenge 2018-19 Round 3 - Junior Division

Jessie, James, and Meowth, members of the honourable Team Rocket, are big fans of the letter R. It's just such an awe-inspiring letter! It only makes sense that it should feature prominently on all of their uniforms and equipment.

James is generally tasked with painting the letter R onto Team Rocket's various belongings. Sometimes he needs to paint small R's, and other times enormous ones. As such, he'd like to get in some extra practice with painting the most beautifully perfect R's that he can.

Today, James would like to paint an R of size S (3 \le S \le 30) onto a grid with 2S - 1 rows and S columns. The required state of each cell in the grid may be represented with a character, either # if that cell should be painted, or . if it should be left unpainted.

The top portion of an R of size S consists of the painted outline of a square of cells with side-length S, with its top-right and bottom-right corners left unpainted. Below that, a vertical line of S - 1 cells should be painted, running up from the grid's bottom-left corner to just below the square. Finally, to the right of that, a diagonal line of S - 1 cells should be painted, running up-left from the grid's bottom-right corner to just below the square. Please see the sample cases for a demonstration.

Help James visualize what a perfect R of size S should look like!

Input Specification

The first and only line of input consists of a single integer, S.

Output Specification

Output a grid with 2S - 1 rows and S columns of characters, representing an R of size S.

Sample Input 1

5

Sample Output 1

####.
#...#
#...#
#...#
####.
##...
#.#..
#..#.
#...#

Sample Input 2

3

Sample Output 2

##.
#.#
##.
##.
#.#

Comments

There are no comments at the moment.