Programming contests

DEIK Regionális Programozó Csapatverseny, egyetemi kategória, 2024. december 1.

December 1, 2024, 10:00 AM – December 1, 2024, 3:00 PM

Pine

Christmas is approaching, so Péter is setting up a Christmas tree. To build the tree, he uses odd-length elements made entirely of x’s - x, xxx, xxxxx, ... - and odd-length elements that have x’s on the edges and dots (.) inside - x, x.x, x..x, x...x, .... The structure of the tree is shown in the diagram below:

   x         Top part
  x.x
 x...x       Leaf section
x.....x
  x.x
 x...x       Leaf section
x.....x
  x.x
 x...x       Leaf section
x.....x
  xxx
  xxx        Trunk
  xxx
  xxx
The top part of the tree is always a single x. For this tree, there are N=3N=3 leaf sections, each with a height of M=3M=3, and the shortest element in the leaf sections is always x.x. The trunk is H=4H=4 high and W=3W=3 wide. Unfortunately, the tree exists only as a thought in Péter’s mind — it’s up to you to write the program that will create it.”

Input specification

A single line with the positive integers NMHWN\ M\ H\ W, separated by a space.

Output specification

A tree that matches the parameters. All alignments should be done with spaces, but there should be no unnecessary characters at the end of the lines.

Constraints

2N422\le N \le 42
3M423\le M \le 42
2H422\le H \le 42
1W421\le W \le 42
WW is always an odd integer and less than 2M+12M+1.

Sample input 1

  1. 3 3 4 3
download as text file

Sample output 1

  1.    x
  2.   x.x
  3.  x...x
  4. x.....x
  5.   x.x
  6.  x...x
  7. x.....x
  8.   x.x
  9.  x...x
  10. x.....x
  11.   xxx
  12.   xxx
  13.   xxx
  14.   xxx
download as text file

Sample input 2

  1. 3 4 6 1
download as text file

Sample output 2

  1.     x
  2.    x.x
  3.   x...x
  4.  x.....x
  5. x.......x
  6.    x.x
  7.   x...x
  8.  x.....x
  9. x.......x
  10.    x.x
  11.   x...x
  12.  x.....x
  13. x.......x
  14.     x
  15.     x
  16.     x
  17.     x
  18.     x
  19.     x
download as text file
University of Debrecen; Faculty of Informatics; v. 09/30/2024