DWITE '08 R3 #1 - ASCII Rhombus

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Problem type
DWITE Online Computer Programming Contest, December 2008, Problem 1

In geometry, a rhombus is a four-sided polygon, where every side is the same length. Technically speaking, a square is a special case of a rhombus; but the shape is more commonly recognized as the diamond suit on playing cards.

Let's draw some!

The input will contain 5 lines, odd integers 1 \le N \le 7 – the height of a desired rhombus.

The output will contain 5 rhombi, drawn using pound signs (#) and periods (.). Refer to sample input for the desired shape and format.

Sample Input

3
5
1
1
1

Sample Output

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

Problem Resource: DWITE

Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported

Comments


  • 3
    vsarca  commented on Sept. 12, 2024, 10:56 p.m.

    It took me 0.5 hours to solve this in Brainf***. My code is 322 characters long, with 184 characters used for computation and 138 for subtracting ASCII '0' from the input chars and storing the output chars. At this time my submission is the 6th fastest on the leaderboard. I would rate this as comparable to a 7p solved in C++ regarding implementation difficulty and a 10/10 in terms of fun. I recommend this for beginner Brainf*** programmers since it is easy and fun to solve. Good luck!