Woburn Challenge 2018-19 Round 3 - Junior Division

Problem 3: R

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 ≤ S ≤ 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 Format

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

Output Format

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

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

All Submissions
Best Solutions


Point Value: 5 (partial)
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 01, 2019
Author: SourSpinach

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

It's quiet in here...