编程介的小学生 2017-04-01 03:10 采纳率: 20.3%
浏览 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
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写