#t500. 画矩形

画矩形

Draw a Rectangle

Problem Description

Draw a rectangle according to the given parameters.

Input Format

One line containing four parameters: the first two are integers representing the rectangle's height and width (height no less than 3 rows and no more than 10 rows; width no less than 5 columns and no more than 10 columns); the third parameter is a character used to draw the rectangle's border; the fourth parameter is 1 or 0, where 0 means hollow and 1 means solid.

Output Format

Output the drawn figure.

Sample Input

7 7 @ 0

Sample Output

@@@@@@@
@     @
@     @
@     @
@     @
@     @
@@@@@@@

Hint

  • Use nested loops: the outer loop handles rows and the inner loop handles columns; move to a new line after each row is printed.
  • The key to a hollow rectangle is checking whether the current cell is on the border — the first row, the last row, the first column, or the last column. Think about how to combine these conditions with ||: print the character on border cells and a space elsewhere.
  • Verify with the sample: 7 7 @ 0 → the border is all @ and the interior is spaces.