首页 > ACM题库 > HDU-杭电 > hdu 2618 If You are my legend待解决[解题报告]C++
2014
02-12

hdu 2618 If You are my legend待解决[解题报告]C++

If You are my legend

问题描述 :

If you are my legend——If your are my legend, let it as long as the heaven and earth endure(Sky Long Earth Nine).

     WhereIsHeroFrom loves a girl very much, we call her X Gu Niang. But today they can’t get together because they live in two different provinces and their distance is much farther. Now they want to build a castle for their future.

The castle is so Complex, See the figure below:


     The castle 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.
     Now, give A to you , please help them construct their castle, the unit cube represented as shown below:

输入:

Input contains integers N , M, (1 <= N, M <= 30)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.

输出:

Input contains integers N , M, (1 <= N, M <= 30)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.

样例输入:

2 4
2 2 3 2
1 1 2 3

样例输出:

************+---+****
***********/   /|****
**********+---+---+**
****+---+-|  /   /|-+
***/   /  | +---+ |/|
**+---+---+-|   | + |
**|   |  /  |   |/| +
**|   | +---+---+ |/|
**+---+-|   |   | + |
*/   /  |   |   |/| +
+---+---+---+---+ |/*
|   |   |   |   | +**
|   |   |   |   |/***
+---+---+---+---+****


  1. 第一题是不是可以这样想,生了n孩子的家庭等价于n个家庭各生了一个1个孩子,这样最后男女的比例还是1:1

  2. 约瑟夫也用说这么长……很成熟的一个问题了,分治的方法解起来o(n)就可以了,有兴趣可以看看具体数学的第一章,关于约瑟夫问题推导出了一系列的结论,很漂亮

  3. 第一句可以忽略不计了吧。从第二句开始分析,说明这个花色下的所有牌都会在其它里面出现,那么还剩下♠️和♦️。第三句,可以排除2和7,因为在两种花色里有。现在是第四句,因为♠️还剩下多个,只有是♦️B才能知道答案。