我有个相对简单的法,过了样例,但是wa
查看原帖
我有个相对简单的法,过了样例,但是wa
1163793
spindrift楼主2023/11/18 20:13
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
using namespace std;

int main()
{
	int a[25][25][25];
	int w, x, h;
	int q;
	cin >> w >> x >> h >> q;
	int V = w * x * h;
	int x1, y1, z1;
	int x2, y2, z2; 
	int sum = 0;
	while (q--) {
		cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
		for (int i = 1; i < w; i++)
			for (int j = 1; j < x; j++)
				for (int g = 1; g < h; g++)
					a[i][j][g] = 1;
		for (int i = x1; i <= x2; i++)//我要删除的地方
			for (int j = y1; j <= y2; j++)
				for (int g = z1; g <= z2; g++)
					if (a[i][j][g] == 1) {
						a[i][j][g] = 0;
						sum++;
					}
	}
	cout << V - sum;
	return 0;
}
2023/11/18 20:13
加载中...