Rhombus
Time limit1sMemory limit1024 MB
Given an odd n and a range [a, b], print an n by n grid marking with * the cells whose Manhattan distance from the center is between a and b.
- Level
Easy2 of 10
- Topics
- Implementation, Simulation
- Solved
- No attempts yet
Statement
A square grid of size is given, where is odd. The center of the grid is the cell . The distance between two cells and is .
A rhombus with parameters is the set of cells whose distance from the center is between and , inclusive.
Given , , and , draw the rhombus.
Input
The first line contains an integer (, is odd). The second line contains an integer . The third line contains an integer (, and if , then ).
Output
Print lines, each with characters. A cell that belongs to the rhombus is printed as *, and a cell that does not is printed as ..