A1091 Acute Stroke[bfs]

在这里插入图片描述

#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<algorithm>
#include<map>
#include<cstring>
#include<set>
using namespace std;
struct node
{
	int x, y, z;
}Node;
int n, m, slice, T;
int pixel[1290][130][61];
bool inq[1290][130][61];
int X[6] = { 0,0,0,0,1,-1 };
int Y[6] = { 0,0,1,-1,0,0 };
int Z[6] = { 1,-1,0,0,0,0 };

bool judge(int x, int y, int z)
{
	if (pixel[x][y][z] == 0 || inq[x][y][z] == true)
		return false;
	return true;
}

int bfs(int x, int y, int z)
{
	int tot = 0;
	queue<node>q;
	Node.x = x, Node.y = y, Node.z = z;
	q.push(Node);
	inq[x][y][z] = true;
	while (!q.empty())
	{
		node top = q.front();
		q.pop();
		tot++;
		for (int i = 0; i < 6; i++)
		{
			int newx = top.x + X[i];
			int newy = top.y + Y[i];
			int newz = top.z + Z[i];
			if (judge(newx, newy, newz))
			{
				Node.x = newx, Node.y = newy, Node.z = newz;
				q.push(Node);
				inq[newx][newy][newz] = true;
			}
		}
	}
	if (tot >= T) return tot;
	else return 0;
}

int main()
{
	cin >> n >> m >> slice >> T;
	for (int z = 0; z < slice; z++)
		for (int x = 0; x < n; x++)
			for(int y=0;y<m;y++)
			{
				cin >> pixel[x][y][z];
			}
				
			
	int ans = 0;
	for (int z = 0; z < slice; z++)
		for (int x = 0; x < n; x++)
			for (int y = 0; y < m; y++)
			{
				if (judge(x,y,z))
					ans += bfs(x, y, z);
			}
	cout << ans << endl;
	return 0;
}
Acute3D Viewer是一款用于查看Acute3D软件生成的三维模型的软件。以下是Acute3D Viewer的安装教程。 第一步,打开Acute3D Viewer的安装文件,双击运行该文件。 第二步,选择您要将Acute3D Viewer安装到的目标文件夹。您可以选择默认目标文件夹,也可以自定义目标文件夹。点击“下一步”继续。 第三步,选择开始菜单文件夹。您可以选择将Acute3D Viewer的快捷方式添加到开始菜单的默认文件夹,也可以选择创建一个新的文件夹。点击“下一步”继续。 第四步,选择额外任务。您可以选择添加Acute3D Viewer的桌面快捷方式和快速启动图标。点击“下一步”继续。 第五步,选择安装类型。您可以选择完全安装或者自定义安装。如果您对安装过程不了解,建议选择默认安装。点击“下一步”继续。 第六步,点击“安装”按钮开始安装Acute3D Viewer。安装过程可能需要一些时间,请耐心等待。 第七步,等待安装完成。安装完成后,您可以选择打开Acute3D Viewer。 第八步,启动Acute3D Viewer。在启动Acute3D Viewer之前,系统可能会提示您选择连接Acute3D Viewer的3D模型文件的默认应用程序。您可以选择Acute3D Viewer作为默认应用程序,然后单击“确定”。 这样,您就成功地安装了Acute3D Viewer。现在,您可以使用Acute3D Viewer来查看和浏览Acute3D软件生成的三维模型了。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值