Scaled Chessboard
InterviewTime limit1sMemory limit128 MB
Print a checkerboard of R by C cells where each cell is scaled to an A by B block of X or dot characters.
- Level
Easy2 of 10
- Topics
- Simulation, Implementation
- Solved
- No attempts yet
Problem
You need to print a chessboard made of black and white cells.
The cell in the upper-left corner is black. Moving one cell horizontally or vertically changes the color, so the colors alternate across the board. A black cell is printed as X, and a white cell is printed as ..
The original board has R rows and C columns. Each original cell must be expanded to a block that is A characters tall and B characters wide. Given R, C, A, and B, print the expanded board.
Input
The first line contains two positive integers R and C (1 <= R, C <= 10).
The second line contains two positive integers A and B (1 <= A, B <= 10).
Output
Print the described board using exactly R * A lines, each containing exactly C * B characters.