logo AlgoBeat OnlineJudge
登录 注册

#216961. [ICPC 2017 Qingdao R] The Squared Mosquito Coil

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Lusrica designs a mosquito coil in a board with grids. The mosquito coil is a series of consecutive grids, each two neighboring grids of which share a common border. If two grids in the mosquito coil are not consecutive, they do not share any border, but they can share a common endpoint.

The mosquito coil Lusrica designed starts from the upper left corner of the board. It goes right to the last available grid. Alter the direction and go downward to the last available grid, and alter the direction again going left to the last available grid. To carry on after altering the direction and go upward to the last available grid. Then it goes right again and repeats the above turns.

It ends up in a grid such that the above process cannot be continued any more. Your mission now is to print the whole blueprint of Lusrica's mosquito coil.

输入格式

This problem has several test cases and the first line contains an integer () which is the number of test cases. For each case a line contains an integer () indicating the size of the board.

输出格式

For each case with input , output lines to describe the whole board. Each line contains characters. If a grid is a part of Lusrica's mosquito coil, the corresponding character is '#', or ' ' (a single blank) if not.

样例

样例输入 1

5
1
2
3
4
5

样例输出 1

#
##
 #
###
  #
###
####
   #
#  #
####
#####
    #
### #
#   #
#####