题目链接
https://www.nowcoder.com/acm/contest/85/F
思路
记录每一个面 上的点 是否有方块
然后 根据它的输出顺序 遍历访问 如果有 输出 ‘X’ 否则 输出‘.’
但是要注意它的坐标系不是常规的坐标系
AC代码
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits>
#define CLR(a) memset(a, 0, sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
const double PI = 3.14159265358979323846264338327;
const double E = exp(1);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;
const int maxn = 1e3 + 5;
const int MOD = 1e9 + 7;
int xoy[maxn][maxn], xoz[maxn][maxn], yoz[maxn][maxn];
int main()
{
CLR(xoy);
CLR(xoz);
CLR(yoz);
int x, y, z, n;
scanf("%d%d%d%d", &x, &y, &z, &n);
for (int i = 0; i < n; i++)
{
int a, b, c;
scanf("%d%d%d", &a, &b, &c);
xoy[a][b] = 1;
xoz[a][c] = 1;
yoz[b][c] = 1;
}
for (int i = y; i >= 1; i--)
{
for (int j = 1; j <= x; j++)
{
if (xoy[j][i])
printf("x");
else
printf(".");
}
printf(" ");
for (int j = 1; j <= z; j++)
{
if (yoz[i][j])
printf("x");
else
printf(".");
}
printf("
");
}
printf("
");
for (int i = 1; i <= z; i++)
{
for (int j = 1; j <= x; j++)
{
if (xoz[j][i])
printf("x");
else
printf(".");
}
printf("
");
}
}