当前位置: 首页 > news >正文

搭建网站免费空间网站用什么颜色

搭建网站免费空间,网站用什么颜色,毛绒玩具东莞网站建设,wordpress上传视频黑屏1112. 迷宫 - AcWing题库 一天Extense在森林里探险的时候不小心走入了一个迷宫#xff0c;迷宫可以看成是由 n∗n 的格点组成#xff0c;每个格点只有2种状态#xff0c;.和##xff0c;前者表示可以通行后者表示不能通行。 同时当Extense处在某个格点时#xff0c;他只…1112. 迷宫 - AcWing题库 一天Extense在森林里探险的时候不小心走入了一个迷宫迷宫可以看成是由 n∗n 的格点组成每个格点只有2种状态.和#前者表示可以通行后者表示不能通行。 同时当Extense处在某个格点时他只能移动到东南西北(或者说上下左右)四个方向之一的相邻格点上Extense想要从点A走到点B问在不走出迷宫的情况下能不能办到。 如果起点或者终点有一个不能通行(为#)则看成无法办到。 注意A、B不一定是两个不同的点。 输入格式 第1行是测试数据的组数 k后面跟着 k 组输入。 每组测试数据的第1行是一个正整数 n表示迷宫的规模是 n∗n 的。 接下来是一个 n∗n 的矩阵矩阵中的元素为.或者#。 再接下来一行是 4 个整数 ha,la,hb,lb描述 A 处在第 ha 行, 第 la 列B 处在第 hb 行, 第 lb 列。 注意到 ha,la,hb,lb 全部是从 0 开始计数的。 输出格式 k行每行输出对应一个输入。 能办到则输出“YES”否则输出“NO”。 数据范围 1≤n≤100 输入样例 2 3 .## ..# #.. 0 0 2 2 5 ..... ###.# ..#.. ###.. ...#. 0 0 4 0输出样例: YES NO 解析 使用dfs进行判断代码要比bfs简洁 dfs代码 #includeiostream #includestring #includecstring #includecmath #includectime #includealgorithm #includeutility #includestack #includequeue #includevector #includeset #includemath.h #includemap #includesstream #includedeque #includeunordered_map using namespace std; typedef long long LL; const int N 1e2 2; int n, ha, la, hb, lb; char str[N][N]; bool vis[N][N]; int dx[4] { -1,0,1,0 }, dy[4] { 0,1,0,-1 }; bool dfs(int x, int y) {if (str[x][y] #)return false;if (x hb y lb)return true;for (int i 0; i 4; i) {int a x dx[i], b y dy[i];if (a 0 || a n || b 0 || b n)continue;if (vis[a][b])continue;vis[a][b] 1;if (dfs(a, b))return true;}return false; }int main() {int T;cin T;while (T--) {cin n;for (int i 0; i n; i) {scanf(%s, str[i]);}cin ha la hb lb;memset(vis, 0, sizeof vis);if (dfs(ha, la))cout YES endl;else cout NO endl;}return 0; }BFS代码 #includeiostream #includestring #includecstring #includecmath #includectime #includealgorithm #includeutility #includestack #includequeue #includevector #includeset #includemath.h #includemap #includesstream #includedeque #includeunordered_map using namespace std; typedef long long LL; const int N 1e2 2; int n,ha,la,hb,lb; char str[N][N]; typedef pairint, int PII; bool vis[N][N];string bfs() {string ret1 YES, ret2 NO;if (str[ha][la] # || str[hb][lb] #)return ret2;int dx[4] { -1,0,1,0 }, dy[4] { 0,1,0,-1 };memset(vis, 0, sizeof vis);queuePIIq;q.push({ ha,la });vis[ha][la] 1;while (!q.empty()) {auto t q.front();q.pop();if (t.first hb t.second lb)return ret1;for (int i 0; i 4; i) {int a t.first dx[i], b t.second dy[i];if (a 0 || a n || b 0 || b n)continue;if (str[a][b] #||vis[a][b])continue;vis[a][b] 1;q.push({ a,b });}}return ret2; }int main() {int T;cin T;while (T--) {cin n;for (int i 0; i n; i) {scanf(%s, str[i]);}cin ha la hb lb;cout bfs() endl;}return 0; }
http://wiki.neutronadmin.com/news/265063/

相关文章:

  • 建个网站要花多少钱wordpress登录cookies
  • hanchengkeji杭州网站建设百度上怎么发布信息啊
  • 网站设计公司要多少钱网站优化 书
  • 做网站策划容易遇到哪些问题分析网站建设
  • 简述电子商务网站建设的过程无锡哪里有建设网站
  • 英文手机商城网站建设建设工程专注在哪个网站
  • 成都专业的网站建设公司网站建设代理政策
  • 常州市住房建设局网站海外网深一度
  • 做番号类网站违法吗wordpress移动主题设计
  • 西安网站seo工作室wordpress 园林模板
  • 域名申请而完成以后怎么做网站网站设计项目书
  • 推广网站免费网站管理系统后台不能发布文章了
  • 网站建设的优势是什么自己建设网站怎么盈利
  • 口碑最好的网站建设开发网站服务
  • 医疗网站源码单页网站制作软件
  • 微网站制作方案网站推广的目的是什么
  • 长沙做企业网站推广的公司抖音代运营计划书
  • 管理系统 网站模板音乐网站建设教程视频
  • 郑州建站程序品牌开发者选择建议
  • 网站开发工程师自学网络服务器配置与管理考试题
  • 电子商务网站 备案js博客网站开发计划书
  • 海淀营销型网站建设酷炫的网站模板免费下载
  • ?a品定制网站开发设计素材网排名
  • 镇巴作风建设网站珠海企业网站制作公司
  • 网站设计要素 优帮云wordpress用户数据表
  • 保定企业自助建站系统泰州网站设计公司
  • 免费开发网站大全上海网站建设好处
  • 上市公司网站的作用网站外链隐形框架
  • 建德网站建设德品牌网seo查询网站
  • dz 做企业网站国外网站seo免费