编程介的小学生 2017-07-14 05:04 采纳率: 20.5%
浏览 837
已采纳

Advanced ASCII Cubes

The table surface is divided into N by M square cells. Some cubes are stacked one upon another over the cells, forming towers. For each cell the number of cubes stacked over it is given in the matrix A.

Your program must output the view of the table in ASCII graphics, where each cube is represented as shown below:

+---+
/ /|
+---+ |
| | +
| |/
+---+
(here the characters used are '+', '-', '/', '|', their ASCII codes are ASCII 43, 45, 47, 124)

The dot (ASCII 46) must be used as a background.

Constraints

1 <= N, M, Aij <= 60

Input

Input contains integers N M, followed by matrix A, row-by-row. The first row describes the cube tower furthest from the viewer, left to right, and the last row - nearest to the viewer.

Output

Output must contain a string representation of the table view, with minimal number of lines required to show all cubes. Each line must contain a string of equal length, which is the minimal width required to show all cubes.

This problem contains multiple test cases!

The first line of a multiple input is an integer N, then a blank line followed by N input blocks. Each input block is in the format indicated in the problem description. There is a blank line between input blocks.

The output format consists of N output blocks. There is a blank line between output blocks.

Sample Input

2

3 4
1 1 1 1
1 2 1 1
1 1 1 1

3 5
2 2 1 2 2
2 2 1 1 2
3 2 1 2 2

Sample Output

........+---+..........
......+/ /|-+---+---+
...../+---+ |/ / /|
....+-| | +---+---+ |
.../ | |/ / /| +
..+---+---+---+---+ |/.
./ / / / /| +..
+---+---+---+---+ |/...
| | | | | +....
| | | | |/.....
+---+---+---+---+......

......+---+---+...+---+---+
..+---+ / /|../ / /|
./ /|-+---+ |.+---+---+ |
+---+ |/ /| +-| / /| +
| | +---+ |/+---+---+ |/|
| |/ /| +/ / /| + |
+---+---+ |/+---+---+ |/| +
| | | +-| | | + |/.
| | |/ | | |/| +..
+---+---+---+---+---+ |/...
| | | | | | +....
| | | | | |/.....
+---+---+---+---+---+......

  • 写回答

1条回答 默认 最新

  • devmiao 2017-07-29 13:55
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效