Three View

Link: https://ac.nowcoder.com/acm/contest/85/F
Source: Niuke

Title description
Etéreo took out a lot of cubic volumes at home and piled them into a three-dimensional model. Now that you have chosen technology for the college entrance examination, you must be wondering what the three views of this model are!

In the figure, the directions of the xx axis, yy axis and zz axis have been marked. It is now stipulated that the red surface in the figure is the main viewing surface, the blue surface is the right viewing surface (note that the output should be left viewing instead of right viewing), and the yellow surface is the top view. You can observe the sample for specific directions.
Input description: The
four numbers in the first line \mathbb{X}, \mathbb{Y}, \mathbb{Z}, \mathbb{N}X,Y,Z,N, indicating that the size of the three-dimensional space is \mathbb{X } \times \mathbb{Y} \times \mathbb{Z}X×Y×Z and there are \mathbb{N}N cubes.
Next \ mathbb {N} N rows, each row of three integers x_i, y_i, z_ix
I , Y I , Z I , which represents the position coordinates. Output description: output a total of \mathbb{Y} + \mathbb{Z} + 1Y+Z+1 lines, the first \mathbb{Y}Y line per line\mathbb{X} + \mathbb{Z} + 1X+Z+ 1 character, output the front view and the left view, there is a column of spaces between the two pictures; then output a blank line; then follow the \mathbb{Z}Z lines, each line \mathbb{X}X characters, which means Top view. Among them, \texttt{"."}"." means empty, and \texttt{"x"}"x" means there is a cube. Example 1 Input Copy 2 2 2 2 1 1 1 2 2 2

















Output
copy
.x .x
xx

x.
.x
Example 2
Input
Copy
3 3 3 3
1 1 2
2 1 1
1 2 1
Output
Copy
……
x… x…
xx. xx.

xx.
x…

Description
Here you can pull out the picture to enlarge it~

备注:
1 \leq \mathbb{X}, \mathbb{Y}, \mathbb{Z} \leq 10001≤X,Y,Z≤1000
0 \leq \mathbb{N} \leq 10^50≤N≤10
5

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

const int N = 1010;

char zheng[N][N];
char zuo[N][N];
char fu[N][N];

int main(){
    
    
	int x, y, z;
	scanf("%d%d%d", &x, &y, &z);
	
	for (int i = 1; i <= N; i ++)
	  for (int j = 1; j <= N; j ++){
    
    
	  	zheng[i][j] = '.';
	  	zuo[i][j] = '.';
	  	fu[i][j] = '.';
	  }
	
	int n;
	scanf("%d", &n);
	
	for (int i = 1; i <= n; i ++){
    
    
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		zheng[b][a] = 'x';
		zuo[c][b] = 'x';
		fu[c][a] = 'x';
	}
	
	for (int i = 1; i <= y; i ++){
    
    
		for (int j = 1; j <= x; j ++)    cout << zheng[y - i + 1][j];
		cout << " ";
		for (int j = 1; j <= z; j ++)   cout << zuo[j][y - i + 1];
		cout << endl;
	}
	
	cout << endl;
	
	for (int i = 1; i <= z; i ++){
    
    
		 for (int j = 1; j <= x; j ++){
    
    
	  	  cout << fu[i][j];
	  }
	  cout << endl;
	}
	 
	
} 

Guess you like

Origin blog.csdn.net/qq_45772483/article/details/112603812