#C6428. Diamond Pattern
Diamond Pattern
Diamond Pattern
Given an odd integer \(n\) (\(n \ge 3\)) as input, generate a diamond pattern composed of two distinct characters: ■
representing the filled cells and □
representing the empty cells. The diamond is symmetric along its vertical axis and consists of \(n\) rows. The middle row (at index \(\lfloor n/2 \rfloor\)) contains the maximum number of filled cells, and the pattern mirrors above and below this row.
If the input value \(n\) is even or less than 3, output an empty string.
inputFormat
The input is provided from standard input (stdin
) and consists of a single integer n
.
outputFormat
Output the diamond pattern corresponding to the given integer n
to standard output (stdout
). Each row of the pattern should be exactly n
characters long, composed of the characters ■
and □
, and rows are separated by newline characters (\n
). If the input does not meet the requirements (i.e. if \(n\) is even or less than 3), output an empty string.
3
□■□
■■■
□■□
</p>