14419 - Kaela's New Sword   

Description

Image Credit: @ZetsuenTai_8488 on X, Formerly Twitter (https://x.com/ZetsuenTai_8488/status/1684085953856671746)

 

Kaela the blacksmith was exploring an ancient cave to gather some materials to craft an ultimate sword when she came across a beautiful crystal of a rare mineral called Bijouite, also known as the jewel of emotions. This crystal has a clear octahedral shape with concentric layers. To craft an ultimate sword, Kaela needs a thin slice of this crystal, but directly slicing such a rare gem is a tough task as jewels of emotions are known to be extremely fragile. To avoid damaging the crystal, Kaela asked you to write a program to visualize the cross-section of the crystal at any given depth.

The crystal’s cross-section at any depth forms a diamond-shaped pattern. The outermost layer of the diamond is labeled with the letter 'A'. The subsequent inner layers are labeled 'B', 'C', and so forth. After 'Z', the labeling wraps around to 'A' again and continues.

Here is an animation showing the cross-section of the crystal with 5 layers, varying D.

Note that there are spaces before and after the characters. You have to print them out too. For example, for L = 5 and D = 6, you must print:

·········
·········
····A····
···ABA···
··ABCBA··
···ABA···
····A····
·········
·········

 

Input

The input consists of 2 integers, L and D.
L (1 ≤ L ≤ 1000): The total number of layers in the crystal.
D (0 ≤ D < 2 * L - 1): The depth of the cross-section

Output

The cross-section of the crystal at depth D. The cross-section should consist of 2L-1 lines with 2L-1 characters on each line, including spaces. The center of the cross-section should be located at the exact middle point of the Lth line. Also, all line has a newline character ('\n') at the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss