编程介的小学生 2017-04-01 03:10 采纳率: 20.5%
浏览 759
已采纳

Gobang Replaying

Xiao Ming is fond of Gobang( or Five Chess ), and he can replay and save the game after each round for further research. But one day, he found that he coundn't remember the order of his opponent's ( black ) pieces. Fortunately he can remember the order of all the white pieces clearly. We know that Xiao Ming always put the piece beside his opponent's last one, that is at any one of the 8 closest position.

Xiao Ming turns to you for help and you want to write a program to solve the problem.

Input

The first line contains a positive integer N<10, which is the number of rounds. Each round is a 15*15 square. There is a integer in each place, 0 representing no piece, 1 representing a black piece, 2,4,6... representing the white pieces and the order of them.

There is a blank line between each round.

Output

For each round output "Round #i:" in the first line,where i represents the round number. From the second line output a 15*15 square,15 numbers in a line. Each 1 in the input square must be replaced by 1,3,5...which represent the order of the black pieces. Because Xiao Ming maybe wrongly remember the position of the black pieces, there may not have a replay, just output "No solution.".

Print a blank line after each round.

Sample Input

1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 6 0 0 0 0
0 0 0 0 0 0 0 1 2 1 0 0 0 0 0
0 0 0 0 0 0 0 1 1 0 0 0 0 0 0
0 0 0 0 0 0 0 8 0 4 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Sample Output

Round #1:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 6 0 0 0 0
0 0 0 0 0 0 0 1 2 5 0 0 0 0 0
0 0 0 0 0 0 0 7 3 0 0 0 0 0 0
0 0 0 0 0 0 0 8 0 4 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-04-10 15:49
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题