Title Description
Obuchi is a smart kid, and he often gives the kids around to write what they think is interesting. Recently, he is going to explain the three-dimensional map to the children, please help him to draw a three-dimensional map.
Obuchi has an area of m*n rectangular area, which has m*n side length of 1 lattice, each lattice stacked with some of the same size of bricks (building blocks of the length and width of 1), Obuchi want to ask you to print out the three-dimensional map of these lattice. We define each block as the following format, and do not do any rollover rotation, only strictly in this form:
Each vertex is represented by 1 plus ' + ', long with 3 "-", wide with 1 "/", high with two "|" Said. Character ' + ', '-', '/', ' | ' The ASCII code is 43,45,47,124, respectively. Character '. ' (ASCII code 46) needs to be used as a background output, that is, the blank part of the stereoscopic map needs to be '. ' To replace. The drawing of a stereoscopic chart is as follows:
If two blocks are adjacent, the diagram is:
If two blocks are adjacent, the diagram is:
If two blocks are adjacent, the diagram is:
In a stereoscopic diagram, the bottom-left corner of the first block (that is, the most bottom block) of the grid (the 1th column of row m) above is defined as the point at the lower-left corner of the entire graph (m,1).
Input/output format
Input format:
The input file drawing.in the first line of useful spaces separated by 2 integers m and n, indicating a m*n lattice (1<=m,n<=50).
The next M-line is a m*n matrix with n spaces separated by a line of integers, where the integer on row J of line I indicates how many bricks are stacked on the sub-column of row J of Line I (1<= the number of bricks on each lattice <=100).
Output format:
Output file Drawing.out contains the title of the three-dimensional graph, is a K-row l column of the string matrix, where K and L represent a minimum of K row L column in order to output three-dimensional map.
Input and Output Sample input example # #:
3 42 2 1 22 2 1 13 2 1 2
Sample # # of output:
......+---+---+...+---+.. +---+ / /|.. / /|. / /|-+---+ |. +---+ |+---+ |/ /| +-| | +| | +---+ |/+---+ |/|| | / /| +/ /|-+ |+---+---+ |/+---+ |/| +| | | +-| | + |/.| | | / | | -| +.. +---+---+---+---+ |/...| | | | | +....| | | | | /.....+---+---+---+---+......
Description
The fourth question of NOIP2008 popularization group
---------------------------------I'm a split line------------------------------------------------------------------
1#include <iostream>2#include <cstdio>3#include <cstring>4#include <cmath>5#include <algorithm>6#include <queue>7#include <cstdlib>8 using namespacestd;9 intnum[Wuyi][Wuyi]={{0}};Ten inthigh=-99999, wide=-99999; One Charmap[301][301]={{'.'}}; A intRead () { - intx=0, f=1;CharCh=GetChar (); - while(ch<'0'|| Ch>'9'){if(ch=='-') f=-1; ch=GetChar ();} the while(ch>='0'&&ch<='9') {x=x*Ten+ch-'0'; ch=GetChar ();} - returnx*F; - } - voidPrintint,int); + intMain () - { +Std::ios::sync_with_stdio (false); A intn,m; atCin>>m>>N; -Wide=4*n+2*m+1; - for(intI=1; i<=m;i++) - for(intj=1; j<=n;j++) - { -Cin>>Num[i][j]; inHigh=max (high,num[i][j]*3+2* (m-i+1)+1); - } to for(intI=1; i<=m;i++) + for(intj=1; j<=n;j++) - for(intk=0; k<num[i][j];k++) the { * intx=high-3* (k +2)-2* (m-i) +1; $ inty=4*j+2* (m-i-1)-1;Panax Notoginseng print (x, y); - } the for(intI=1; i<=high;i++) + { A for(intj=1; j<=wide;j++) thecout<<Map[i][j]; +cout<<Endl; - } $ return 0; $ } - voidPrintintAintBB) { - intx, y; thex=a+3; y=b; -map[x][y]='+';Wuyimap[x][y+1]='-'; themap[x][y+2]='-'; -map[x][y+3]='-'; Wumap[x][y+4]='+'; -map[x-1][y]='|'; Aboutmap[x-1][y+1]=' '; $map[x-1][y+2]=' '; -map[x-1][y+3]=' '; -map[x-1][y+4]='|'; -map[x-1][y+5]='/'; Amap[x-2][y]='|'; +map[x-2][y+1]=' '; themap[x-2][y+2]=' '; -map[x-2][y+3]=' '; $map[x-2][y+4]='|'; themap[x-2][y+5]=' '; themap[x-2][y+6]='+'; themap[x-3][y]='+'; themap[x-3][y+1]='-'; -map[x-3][y+2]='-'; inmap[x-3][y+3]='-'; themap[x-3][y+4]='+'; themap[x-3][y+5]=' '; Aboutmap[x-3][y+6]='|'; themap[x-4][y+1]='/'; themap[x-4][y+2]=' '; themap[x-4][y+3]=' '; +map[x-4][y+4]=' '; -map[x-4][y+5]='/'; themap[x-4][y+6]='|';Bayimap[x-5][y+2]='+'; themap[x-5][y+3]='-'; themap[x-5][y+4]='-'; -map[x-5][y+5]='-'; -map[x-5][y+6]='+'; the return; the}
View Code
NOIP2008 Universal group T4 Three-dimensional graphical report-S.B.S. (Construction not completed)