#P1538. Digital Dance Formation

    ID: 14824 Type: Default 1000ms 256MiB

Digital Dance Formation

Digital Dance Formation

In an era that emphasizes collaboration over individual performance, the arrangement of the group takes center stage. To celebrate the annual countdown, the students have decided to perform a "Digital Dance" – a formation in which everyone lies down in such a way that when viewed from above the group forms a multi‐digit number. Each participant plays a role in forming the segments of the digit, ensuring proper horizontal and vertical alignment.

Your task is to simulate this beautiful formation. Given a size parameter and a number (possibly with multiple digits), use a seven‐segment display style to print the number.

The seven segments (labeled from 0 to 6) are arranged as follows:

\(\quad 0\quad\)
\(1\)        \(2\)
\(\quad 3\quad\)
\(4\)        \(5\)
\(\quad 6\quad\)

For a given digit d and size s, its printed pattern has a width of s+2 characters and a height of 2s+3 rows. The horizontal segments (0, 3, 6) are printed as a single space, followed by s dashes in LaTeX form (\(-\)), followed by a space if the segment is on; otherwise, print the same number of spaces. For the vertical segments, each of the s lines prints the left segment (segment 1 or 4) as a '|' if on (or a space if off), then s spaces, then the right segment (segment 2 or 5) as a '|' if on (or a space if off).

The seven‐segment configuration for each digit is:

  • 0: segments 0, 1, 2, 4, 5, 6
  • 1: segments 2, 5
  • 2: segments 0, 2, 3, 4, 6
  • 3: segments 0, 2, 3, 5, 6
  • 4: segments 1, 2, 3, 5
  • 5: segments 0, 1, 3, 5, 6
  • 6: segments 0, 1, 3, 4, 5, 6
  • 7: segments 0, 2, 5
  • 8: segments 0, 1, 2, 3, 4, 5, 6
  • 9: segments 0, 1, 2, 3, 5, 6

Print the number by printing the corresponding pattern for each digit side‐by‐side (separated by a single space).

inputFormat

The input consists of a size parameter s (an integer, 1 ≤ s ≤ 10) followed by a nonempty string n of up to 8 digits. Both are given on the same line separated by a space.

outputFormat

Print the seven‐segment display representation of the number. There should be exactly 2s+3 lines, and each digit occupies a width of s+2 characters. Adjacent digits are separated by a single space.

Note: Use LaTeX format for any formulas in the description if needed (e.g. \(2s+3\), \(s+2\)).

sample

2 12345
      --   --        --

| | | | | |
| | | | | |
-- -- -- -- | | | | | | | | | | -- -- --

</p>