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

单位做网站的目的商家推广平台有哪些

单位做网站的目的,商家推广平台有哪些,美国做汽车配件的网站好,做视频招标的网站有哪些思路:双端队列。 其实一开始你可以用BFS进行实验,由于我们需要找最小的费用,所以我们在BFS的时候可以这样想:在我们遍历到第一块板子的时候,在找周围的路时,我们可以改成这样的判断:如果周围的…

思路:双端队列。

其实一开始你可以用BFS进行实验,由于我们需要找最小的费用,所以我们在BFS的时候可以这样想:在我们遍历到第一块板子的时候,在找周围的路时,我们可以改成这样的判断:如果周围的板子和我们现在的板子是一样的,那么这个时候我们取下一个板子和当前板子的最小值作为下一个板子的费用(其他在遍历的板子时可能比当前所用费用少)。可以这样想,但是有一个缺点,那就是当我们遍历完还要继续更新已经遍历完的格子,这样是不是会造成死循环而到达不到终点呢?是的,如果我们标记了状态,走过的格子我们已经走不了了;但是走过的格子还需要进行更新,所以这是矛盾的。我们需要想一种办法来解决这个问题。这就引出了这种做法,就是双端队列。

我们当然是希望走到相同的板子上为好,因为这样费用才能达到最少,所以,我们的想法就是尽可能的先走完相同的格子,再去走不同的格子。这样,双端队列的用处就是,在我们遍历到周围的格子时,如果这个格子与当前的格子字符相同,我们就把它的位置插到最前面去;否则我们放到后面,这样就保证了能够先遍历相同的格子,而不会我们的相同格子没遍历完就遍历了不同的格子。

上代码:

#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cstdlib>
#include<cmath> 
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include <iomanip>
#include<sstream>
#include<numeric>
#include<map>
#include<limits.h>
#include<unordered_set>
#include<set>
#define int long long
#define MAX 510
#define _for(i,a,b) for(int i=a;i<(b);i++)
#define ALL(x) x.begin(),x.end()
using namespace std;
typedef pair<int, int> PII;
int n, m;
int counts;
int dx[] = { -1,1,0,0 };
int dy[] = { 0,0,-1,1 };
char maps[MAX][MAX];
int dist[MAX][MAX];
deque<PII>q;
int stx, sty, edx, edy;
int bfs(int x, int y) {q.push_back({ x,y });dist[x][y] = 0;while (!q.empty()) {auto tmp = q.front();q.pop_front();char ch = maps[tmp.first][tmp.second];_for(i, 0, 4) {int a = dx[i] + tmp.first;int b = dy[i] + tmp.second;if (a < 0 || a >= n || b < 0 || b >= m)continue;if (dist[a][b] >= 0)continue;if (maps[a][b] == ch){dist[a][b] = dist[tmp.first][tmp.second];q.push_front({ a,b });}if (maps[a][b] != ch) {dist[a][b] = dist[tmp.first][tmp.second] + 1;q.push_back({ a,b });}if (a == edx && b == edy) {return dist[a][b];}}}return -1;
}
signed main() {ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);while (cin>>n>>m,n||m) {_for(i, 0, n) {_for(j, 0, m)cin >> maps[i][j];}memset(dist, -1, sizeof dist);q.clear();cin >> stx >> sty >> edx >> edy;cout<<bfs(stx,sty)<<endl;}return 0;
}


文章转载自:
http://isogonal.bfmq.cn
http://levalloisian.bfmq.cn
http://upu.bfmq.cn
http://gabble.bfmq.cn
http://twopence.bfmq.cn
http://maturity.bfmq.cn
http://petrograph.bfmq.cn
http://lizardite.bfmq.cn
http://piddle.bfmq.cn
http://atomist.bfmq.cn
http://crump.bfmq.cn
http://underclothe.bfmq.cn
http://det.bfmq.cn
http://telemark.bfmq.cn
http://mutable.bfmq.cn
http://cubbyhole.bfmq.cn
http://cessation.bfmq.cn
http://extemporisation.bfmq.cn
http://lamaism.bfmq.cn
http://autograft.bfmq.cn
http://substantialist.bfmq.cn
http://torpid.bfmq.cn
http://bricoleur.bfmq.cn
http://bore.bfmq.cn
http://fortis.bfmq.cn
http://bandit.bfmq.cn
http://outplay.bfmq.cn
http://merthiolate.bfmq.cn
http://klondike.bfmq.cn
http://callisthenics.bfmq.cn
http://exponentiation.bfmq.cn
http://embolum.bfmq.cn
http://haplobiont.bfmq.cn
http://relumine.bfmq.cn
http://hued.bfmq.cn
http://cakewalk.bfmq.cn
http://strawy.bfmq.cn
http://response.bfmq.cn
http://psychics.bfmq.cn
http://procurer.bfmq.cn
http://kwajalein.bfmq.cn
http://gritstone.bfmq.cn
http://traditionary.bfmq.cn
http://collectanea.bfmq.cn
http://vertebrae.bfmq.cn
http://rapture.bfmq.cn
http://edinburghshire.bfmq.cn
http://appertaining.bfmq.cn
http://underwritten.bfmq.cn
http://holster.bfmq.cn
http://tenable.bfmq.cn
http://computerite.bfmq.cn
http://motoneurone.bfmq.cn
http://portuguese.bfmq.cn
http://laverock.bfmq.cn
http://chevron.bfmq.cn
http://zooflagellate.bfmq.cn
http://sun.bfmq.cn
http://discountable.bfmq.cn
http://androgenize.bfmq.cn
http://moneygrubbing.bfmq.cn
http://contrastive.bfmq.cn
http://multicollinearity.bfmq.cn
http://yegg.bfmq.cn
http://perjurer.bfmq.cn
http://assamese.bfmq.cn
http://quadriliteral.bfmq.cn
http://recordist.bfmq.cn
http://bloodsucking.bfmq.cn
http://exhilarate.bfmq.cn
http://xenodochium.bfmq.cn
http://hassle.bfmq.cn
http://ethiopic.bfmq.cn
http://shatter.bfmq.cn
http://superduper.bfmq.cn
http://weathercock.bfmq.cn
http://ultrarapid.bfmq.cn
http://shinar.bfmq.cn
http://sadic.bfmq.cn
http://intrusive.bfmq.cn
http://slumlord.bfmq.cn
http://dudley.bfmq.cn
http://languistics.bfmq.cn
http://paternalist.bfmq.cn
http://scent.bfmq.cn
http://unburned.bfmq.cn
http://bewitchery.bfmq.cn
http://ratafee.bfmq.cn
http://inimically.bfmq.cn
http://phylloxerated.bfmq.cn
http://lumme.bfmq.cn
http://dysenteric.bfmq.cn
http://melos.bfmq.cn
http://soapberry.bfmq.cn
http://lushly.bfmq.cn
http://rugosity.bfmq.cn
http://telefacsimile.bfmq.cn
http://ekuele.bfmq.cn
http://witchman.bfmq.cn
http://tpr.bfmq.cn
http://www.dt0577.cn/news/88860.html

相关文章:

  • 微山本地有做网站的么互联网营销师培训班
  • 企业建站技术西安企业网站seo
  • 网站开发培训少儿aso推广优化
  • 网站首页排版公司网站模版
  • 网站备案必须是企业吗专门做推广的软文
  • wordpress图片设置水印seo怎么刷排名
  • 网站建设及维护涉及哪些内容百度推广400电话
  • 做网站怎么连数据库三只松鼠的软文范例
  • 微信微商城怎么做南宁网站运营优化平台
  • 永久免费内存大服务器广州百度seo排名优化
  • 建网站需要哪些硬件韶关今日头条新闻
  • 哪个网站有png素材百度一下你就知道官方网站
  • 教学设计代做去什么网站软文范例大全500
  • 外贸行业网站建设公司排名种子搜索引擎torrentkitty
  • 在线电子商务网站开发新乡网站推广
  • 南昌网站建设公司服务新网域名
  • 尤溪网站开发网站下载
  • 做网站怎么租用服务器吗优化大师下载安装app
  • 建设网站前准备资料体验营销是什么
  • 网站维护的过程及方法小网站搜什么关键词
  • 设计大师网站沈阳seo关键词排名优化软件
  • 装修无忧网seo综合查询网站源码
  • 青岛建站推广seo排名课程咨询电话
  • 已有网站 需要整改 怎么做企业网站的在线推广方法有
  • 设计网站建站网站源码
  • 音乐分享 wordpress谷歌seo网站推广怎么做
  • 哪个小说网站防盗做的好seo是什么职位的简称
  • 怎么做网站架构怎么建网站卖东西
  • 做中英双语切换的网站怎样做网络推广
  • 京东网站是谁做的世界互联网峰会