ACM2017icpc青岛站(计蒜课重现赛)-The Squared Mosquito Coil(dfs)

此处传送门

The Squared Mosquito Coil

Lusrica designs a mosquito coil in a board with n × n 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.
Input
This problem has several test cases and the first line contains an integer t (1 ≤ t ≤ 36) which is the number of test cases. For each case a line contains an integer n (1 ≤ n ≤ 36) indicating the size of the board.
Output
For each case with input n, output n lines to describe the whole board. Each line contains n characters. If a grid is a part of Lusrica’s mosquito coil, the corresponding character is ‘#’, or ’ ’ (a single blank) if not.
这里写图片描述

我这种弱鸡去不了比赛,只能过后补补题了QAQ…学校弱人也弱什么都弱简直蓝廋,写的代码可能很麻烦,但应

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值