Submit solution
Points:
5
Time limit:
2.0s
Memory limit:
64M
Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
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 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, .
Output Specification
You should output an 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
So the letters increase with alphabetical order?
Yes.
What do we do if N is even?
Not sure if we do this:
cccc cabc cccc
^looks ugly
my formatting screwed up
cccc
cabc
cccc
Added as a sample case.
Input
Output
Oh never mind I thought N was the diameter
diameter is 2n-1