#K35877. Generate Palindrome Pattern

    ID: 25629 Type: Default 1000ms 256MiB

Generate Palindrome Pattern

Generate Palindrome Pattern

Given an odd integer \(n\) (\(n \ge 3\)), generate a symmetric palindromic pattern of \(n\) lines. The pattern is constructed as follows:

  • The first and last lines consist of \(\lfloor n/2 \rfloor\) spaces followed by a single asterisk (*).
  • For the top half of the pattern (including the middle line), each subsequent line starts with fewer spaces and then a star, followed by inner spaces and another star (except for the first line, which has no inner spaces).
  • The bottom half is a mirror image of the top half.

You can assume that the input is always an odd integer greater than or equal to 3.

inputFormat

A single integer (n) provided via standard input, representing the size of the pattern. It is guaranteed that (n) is an odd integer and (n \ge 3).

outputFormat

The symmetric palindromic pattern printed over (n) lines to standard output. Each line should exactly match the expected pattern format.## sample

3
 *

*

</p>