送情报

描述:

走迷宫,其中:

符号 消耗的时间 消耗的体力
. 1 1
w 2 2
m 3 1
x +∞ +∞
从S走到T,体力必须在0以上,求最短的时间

输入:

0 < N、M < 20

Map

P(体力)

输出:

ans

————————————————————集训5.2的分割线————————————————————

思路:只是增加了一种状态:体力,将其纳入vis数组当中即可。注意不要回到起点。找到T不要退出BFS,要搜完整个队列,维护一个时间最短的答案。

代码如下:

/*
ID: j.sure.1
PROG:
LANG: C++
*/
/****************************************/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <string>
#include <iostream>
using namespace std;
/****************************************/
#define LIM (nx >= 0 && nx < n && ny >= 0 && ny < m)
const int N = 25;
int n, m, sx, sy, ex, ey, P, minX = 2e9;
const int d[][2] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}};
char mat[N][N];
bool vis[N][N][1205];
struct Node
{
	int x, y;
	int hp, step;
};
queue <Node> q;

void bfs()
{
	Node t;
	t.x = sx; t.y = sy; t.hp = P; t.step = 0;
	q.push(t);
	while(!q.empty()) {
		t = q.front();
		q.pop();
		for(int dd = 0; dd < 4; dd++) {
			Node nt;
			int &nx = nt.x = t.x + d[dd][0];
			int &ny = nt.y = t.y + d[dd][1];
			if(!LIM || mat[nx][ny] == 'x' || mat[nx][ny] == 'S')
				continue;
			int &np = nt.hp = t.hp, &ns = nt.step = t.step;
			bool ok = false;
			switch(mat[nx][ny])
			{
				case '.': np--; ns++; break;
				case 'w': np-=2; ns+=2; break;
				case 'm': np--; ns+=3; break;
				case 'T': np--; ns++; ok = true; break;
			}
			if(!vis[nx][ny][np] && np > 0) {
				vis[nx][ny][np] = true;
				q.push(nt);
//printf("[%d, %d]->[%d, %d] at hp = %d & t = %d\n", t.x, t.y, nx, ny, np, ns);
				if(ok) minX = min(minX, ns);
			}
		}
	}
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("Intelligence.in", "r", stdin);
//  freopen(".out", "w", stdout);
#endif
	while(~scanf("%d%d", &n, &m), n||m) {
		getchar();
		memset(vis, 0, sizeof(vis));
		for(int i = 0; i < n; i++) {
			for(int j = 0; j < m; j++) {
				scanf("%c", &mat[i][j]);
				switch(mat[i][j])
				{
					case 'S': sx = i; sy = j; break;
					case 'T': ex = i; ey = j; break;
				}
			}
			getchar();
		}
		scanf("%d", &P);
		P = P < 1200 ? P : 1200;
		bfs();
		if(minX == 2e9)
			puts("No");
		else
			printf("%d\n", minX);
	}
	return 0;
}


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Kali Linux提供了几个工具来进行情报搜集。其中一个工具是urlcrazy,它可以帮助用户检测常见的拼写错误,并生成可能的Typo域名。通过检验这些域名是否被使用,urlcrazy可以发现潜在的风险,并统计这些域名的热度来分析危害程度。 另外两个工具是maltego和spiderfoot。Maltego是一款功能强大的信息收集和网络侦查工具,它可以根据给出的域名找到该网站的相关信息,比如子域名、IP地址、DNS服务和相关电子邮件等。它还可以用于调查一个人的信息。而SpiderFoot是一款自动查询公共数据源的侦察工具,可以收集有关IP地址、域名、电子邮件地址、姓名等的情报。它可以通过选择启用的模块来收集数据,并展示给用户。通过扫描返回的数据,SpiderFoot可以揭示目标的大量信息,帮助深入了解可能的数据泄漏、漏洞或其他敏感信息,这些信息可以在渗透测试、红队演习或危险情报中被利用。 综上所述,Kali Linux提供了urlcrazy、maltego和spiderfoot等工具来帮助进行情报搜集。这些工具可以帮助用户收集有关域名、网站和个人的信息,从而更好地了解目标并进行相关分析。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [kali工具(信息收集一)](https://blog.csdn.net/m0_58001548/article/details/130045138)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [kali工具熟悉——情报分析](https://blog.csdn.net/beidideshu/article/details/127367664)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值