关于WarCraft III 的一道编程题,我纠结半天下不了手,求高手给力
作为一个war3狂热爱好者,望高手给力,给出简答。但求快点。Description One day, pfctgeorge was very bored. He looked around his room, and noticed that there were a lot of 1*1*1 cubic meter(m^3) plastic white cubes. Then, he decided to stack these cubes into a 3-Dimension object.We assume that pfctgeorge's room is a 3-Dimensional space. Pfctgeorge stacked every cube located in (x0,y0), that is, the cube was above of those cubes whose coordinate of X is x0 and coordinate of Y is y0 before stacking this cube, and its edge is perpendicular to X-axis,Y-axis of Z-axis respectively.
After stacking all the cubes into the object. Pfctgeorge noticed that there was a pail of colorful paint. So he wanted to painted the object into colorful. However, of course, he can only paint the surface of the object.
Help pfctgeorge to figure out the colorful area of the object in square meter(m^2) after his painting
Input The first line of the input contains an integer T(1<=T<=20) which means the number of test cases.
Then T test cases follow, for every test case, the first line contains two integer m,n(1<=m,n<=10), means the pfctgeorge's room is m meters in width and n meters in length. Then m lines follow, every line contains n integers in the range of 0..100. If j-th number of i-th line is k, it means there are k cubes located in (i,j).
Output For each test case, you should output one line. First, output"Case #C: ", C means the number of the test case which is from 1 to T. Then, output an integer indicates the colorful area of the object in square meter after pfctgeorge's painting