New Year's '15 P3 - Gift Wrap

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

We almost overlooked one thing — Princess Asseylum needs to give her guests gifts! You have to help her wrap the gifts now! A wrapped gift can be represented as an M \times M square matrix of lowercase letters. The very center of the gift should be a, and each other layer from inside out should have b, c, etc.

Input Specification

The first and only line of input will have the number of layers of the gift, N (1 \le N \le 26).

Output Specification

You should output an M \times M matrix, the gift after it is wrapped.

Sample Input 1

2

Sample Output 1

bbb
bab
bbb

Sample Input 2

3

Sample Output 2

ccccc
cbbbc
cbabc
cbbbc
ccccc

Comments


  • -1
    omaewamoushindeiru  commented on Jan. 1, 2015, 9:46 p.m.

    So the letters increase with alphabetical order?


  • 0
    kobortor  commented on Jan. 1, 2015, 5:32 p.m. edited

    What do we do if N is even?

    Not sure if we do this:

    cccc
    cabc
    cccc

    • 0
      kobortor  commented on Jan. 1, 2015, 5:33 p.m.

      my formatting screwed up

      cccc

      cabc

      cccc


      • 0
        FatalEagle  commented on Jan. 1, 2015, 5:41 p.m. edited

        Added as a sample case.

        Input

        2

        Output

        bbb
        bab
        bbb

        • 0
          kobortor  commented on Jan. 1, 2015, 5:52 p.m. edited

          Oh never mind I thought N was the diameter