Programming contests

ECN selejtező programozó csapatverseny, 2019. április 17.

April 17, 2019, 10:15 AM – April 17, 2019, 3:15 PM

Snakes

The Slytherin house at Hogwarts is designing a new crest. It will feature two snakes mirroring each other. The only problem is that they don't know how large to make it. Your program should draw the crest of the appropriate size.

Input Specification

The input will consist of a series of decimal integers inclusively between 1 and 100. Each integer will be followed by exactly one newline character. The final line will consist of a single 0. This line is not to be processed; it simply designates the end of the input.

Output Specification

The output cases are to appear in the same order in which they appear in the input. It would be pointless to give a full text specification of the output for this problem; you'll get the idea from the sample below. Some important things to observe, though: The two snakes are separated by exactly one space at their closest points. The size refers only to the horizontal and vertical components: the diagonal components all have length 1. All trailing spaces should be removed from the lines prior to printing (i.e., no spaces should occur between the final visible character and the newline character). Each crest should be followed by an empty line.

Sample Input

  1. 3
  2. 4
  3. 0
download as text file

Output for Sample Input

  1. /---   ---\
  2. |         |
  3. |         |
  4. |         |
  5. \---\ /---/
  6.     | |
  7.     | |
  8.     | |
  9.  ---/ \---
  10. /----   ----\
  11. |           |
  12. |           |
  13. |           |
  14. |           |
  15. \----\ /----/
  16.      | |
  17.      | |
  18.      | |
  19.      | |
  20.  ----/ \----
download as text file

Original Problem

NMU Invitational Programming Contest, 2001

University of Debrecen; Faculty of Informatics; v. 09/30/2024