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

福州开发网站公司网页制作手机软件下载

福州开发网站公司,网页制作手机软件下载,网络营销推广目的,针对人群不同 网站做细分题目分析 1.双重bfs,遍历两个起点求最短路再计算总和即可 2.唯一的坑点在于对于一个KFC&#xff0c;两人中可能有一个到不了&#xff0c;所以还要对到不了的点距离做处理 #include <bits/stdc.h> using namespace std; using ll long long; const int N 220;struct pos…

 


题目分析

        1.双重bfs,遍历两个起点求最短路再计算总和即可

        2.唯一的坑点在于对于一个KFC,两人中可能有一个到不了,所以还要对到不了的点距离做处理


#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 220;struct pos{int y, x;
}Y, M;char g[N][N];
bool vis[N][N];
int disy[N][N];
int dism[N][N];
int t1, t2;int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};void bfs1()
{memset(vis, 0, sizeof vis);queue<pos> q;q.push(Y);vis[Y.y][Y.x] = 1;while(!q.empty()){pos temp = q.front(); q.pop();for(int i = 0; i < 4; i++){int a = temp.x + dx[i]; int b = temp.y + dy[i];if(a < 1 || b < 1 || a > t2 || b > t1) continue;if(!vis[b][a] && g[b][a] != '#'){vis[b][a] = 1;q.push({b, a});disy[b][a] = disy[temp.y][temp.x] + 1;}}}for(int i = 1; i <= t1; i++){for(int j = 1; j <= t2; j++){if(disy[i][j] == 0) disy[i][j] = 1e7;}}
}void bfs2()
{memset(vis, 0, sizeof vis);queue<pos> q;q.push(M);vis[M.y][M.x] = 1;while(!q.empty()){pos temp = q.front(); q.pop();for(int i = 0; i < 4; i++){int a = temp.x + dx[i]; int b = temp.y + dy[i];if(a < 1 || b < 1 || a > t2 || b > t1) continue;if(!vis[b][a] && g[b][a] != '#'){vis[b][a] = 1;q.push({b, a});dism[b][a] = dism[temp.y][temp.x] + 1;}}}for(int i = 1; i <= t1; i++){for(int j = 1; j <= t2; j++){if(dism[i][j] == 0) dism[i][j] = 1e7;}}}int main()
{while(scanf("%d %d", &t1, &t2) != EOF){memset(disy, 0, sizeof disy);memset(dism, 0, sizeof dism);for(int i = 1; i <= t1; i++) for(int j = 1; j <= t2; j++){scanf(" %c", &g[i][j]);if(g[i][j] == 'Y') Y.x = j, Y.y = i;else if(g[i][j] == 'M') M.x = j, M.y = i;}bfs1();bfs2();int ans = 999;for(int i= 1; i <= t1; i++){for(int j= 1; j <= t2; j++){if(g[i][j] == '@') ans = min(ans, disy[i][j] + dism[i][j]);}}printf("%d\n", ans * 11);}}

http://www.yayakq.cn/news/43261/

相关文章:

  • 设计网站注意哪些问题怎么修改公司网站内容
  • 小语种网站建设公司高邮市建设网站
  • 微网站的优缺点wordpress端口
  • 企业网站建设 总结scratch网站开发
  • 织梦手机网站模板猪八戒托管赏金做网站
  • 点广告挣钱网站有哪些科技公司手机网站
  • 济宁500元网站建设小程序做跳转微网站
  • 网站用的是什么语言rpg制作大师手机版
  • 白酒包装设计网站wordpress注册登录弹窗代码
  • 易企秀网站开发技术公司可以备案几个网站
  • 西安道桥建设有限公司网站视频教程网站模板
  • 电商网站建设文献福州网站开发fjfzwl
  • 如何获得个人免费网站空间中国网络
  • 自建站推广方式公司招聘网站有哪些
  • 做摄影网站公司网页图片下载不了怎么办
  • 微信电商网站开发寿光网站建设推广
  • 湖北省建设厅官方网站文件怎么做正规网站吗
  • 石家庄外贸网站制作在线编辑器
  • 网站设计案例公司网站行程表怎么做
  • 北京网站开发哪好物联网产品
  • 网站视频主持人网站logo大全
  • 搜狗网站做滤芯怎么样自适应网站dedecms代码
  • 代做作业网站广东省54个市
  • 太原网站排名公司wordpress设置html页面
  • 网站建设的er图阿里云服务器挂游戏
  • 网站开发安全性分析长春关键词排名推广
  • 网站建设协浙江特种作业证件查询
  • 网站开发php支付接口中国建设网官网首页
  • 做最好的网站需要什么网站建设海报
  • 黄页营销网站网络推广策略