Colorful Diagonals
Time limit1sMemory limit1024 MB
Given n, the task prints an n by n grid where each cell's letter depends on its distance to the nearest diagonal, cycling from a to z.
- Level
Easy2 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Misha is into computer graphics. He wants to draw an pixel square in different colors.
Misha's monitor supports 26 colors, denoted by the lowercase Latin letters from a to z. Misha colors each pixel with a color that depends on the distance from the pixel to the nearest diagonal.
Cells on the diagonals of the square are colored a. The cells adjacent to them are colored b, the adjacent cells not yet colored are colored c, and so on. After z, Misha goes back to a.
Given , print the picture Misha gets.
Input
The input contains a single integer ().
Output
Print lines of characters each: the picture Misha gets.