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

网站建设合作合同2023新闻热点摘抄

网站建设合作合同,2023新闻热点摘抄,wordpress安装到万网,wordpress 网站搭建【题目来源】https://www.acwing.com/problem/content/190/ 【题目描述】 农民 John 有很多牛,他想交易其中一头被 Don 称为 The Knight 的牛。 这头牛有一个独一无二的超能力,在农场里像 Knight 一样地跳(就是我们熟悉的象棋中马的走法&…

【题目来源】
https://www.acwing.com/problem/content/190/

【题目描述】
农民 John 有很多牛,他想交易其中一头被 Don 称为 The Knight 的牛。
这头牛有一个独一无二的超能力,在农场里像 Knight 一样地跳(就是我们熟悉的象棋中马的走法)。
虽然这头神奇的牛不能跳到树上和石头上,但是它可以在牧场上随意跳,我们把牧场用一个 x,y 的坐标图来表示。
这头神奇的牛像其它牛一样喜欢吃草,给你一张地图,上面标注了 The Knight 的开始位置,树、灌木、石头以及其它障碍的位置,除此之外还有一捆草。
现在你的任务是,确定 The Knight 要想吃到草,至少需要跳多少次。
The Knight 的位置用 K 来标记,障碍的位置用 * 来标记,草的位置用 H 来标记。
这里有一个地图的例子:

             11 | . . . . . . . . . .10 | . . . . * . . . . . 9 | . . . . . . . . . . 8 | . . . * . * . . . . 7 | . . . . . . . * . . 6 | . . * . . * . . . H 5 | * . . . . . . . . . 4 | . . . * . . . * . . 3 | . K . . . . . . . . 2 | . . . * . . . . . * 1 | . . * . . . . * . . 0 ----------------------1 0 1 2 3 4 5 6 7 8 9 0

The Knight 可以按照下图中的 A,B,C,D… 这条路径用 5 次跳到草的地方(有可能其它路线的长度也是 5):

             11 | . . . . . . . . . .10 | . . . . * . . . . .9 | . . . . . . . . . .8 | . . . * . * . . . .7 | . . . . . . . * . .6 | . . * . . * . . . F<5 | * . B . . . . . . .4 | . . . * C . . * E .3 | .>A . . . . D . . .2 | . . . * . . . . . *1 | . . * . . . . * . .0 ----------------------10 1 2 3 4 5 6 7 8 9 0

注意: 数据保证一定有解。

【输入格式】
第 1 行: 两个数,表示农场的列数 C 和行数 R。
第 2..R+1 行: 每行一个由 C 个字符组成的字符串,共同描绘出牧场地图。

【输出格式】
一个整数,表示跳跃的最小次数。

【数据范围】
1≤R,C≤150

【输入样例】

10 11
..........
....*.....
..........
...*.*....
.......*..
..*..*...H
*.........
...*...*..
.K........
...*.....*
..*....*..

【输出样例】
5

【算法代码】

#include<bits/stdc++.h>
using namespace std;const int maxn=155;
char g[maxn][maxn];
int dis[maxn][maxn];
typedef pair<int,int> PII;
int dy[8]= {2,1,-1,-2,-2,-1,1,2};
int dx[8]= {1,2,2,1,-1,-2,-2,-1};
int n,m;int bfs(PII x,PII y) {queue<PII> q;q.push(x);memset(dis,-1,sizeof(dis));dis[x.first][x.second]=0;while(!q.empty()) {PII t=q.front();q.pop();for(int i=0; i<8; i++) {int u=t.first+dx[i];int v=t.second+dy[i];if(u>=0 && v>=0 && u<n && v<m) {if(dis[u][v]==-1 && g[u][v]!='*') {dis[u][v]=dis[t.first][t.second]+1;if(make_pair(u,v)==y) return dis[u][v];q.push({u,v});}}}}return -1;
}int main() {PII start;PII end;cin>>m>>n;for(int i=0; i<n; i++) {for(int j=0; j<m; j++) {cin>>g[i][j];if(g[i][j]=='K') start= {i,j};if(g[i][j]=='H') end= {i,j};}}cout<<bfs(start,end)<<endl;
}/*
in:
10 11
..........
....*.....
..........
...*.*....
.......*..
..*..*...H
*.........
...*...*..
.K........
...*.....*
..*....*..out:
5
*/





【参考文献】
https://www.acwing.com/solution/content/60196/
https://www.acwing.com/solution/content/140308/
https://www.acwing.com/solution/content/82258/







 


文章转载自:
http://munitions.rjbb.cn
http://subsume.rjbb.cn
http://malpighian.rjbb.cn
http://breechclout.rjbb.cn
http://fossilist.rjbb.cn
http://supersalesman.rjbb.cn
http://crossband.rjbb.cn
http://unperfect.rjbb.cn
http://opisthograph.rjbb.cn
http://dilatable.rjbb.cn
http://lifeguard.rjbb.cn
http://harmonist.rjbb.cn
http://putto.rjbb.cn
http://grog.rjbb.cn
http://aftertreatment.rjbb.cn
http://subastringent.rjbb.cn
http://galvanotropism.rjbb.cn
http://incubate.rjbb.cn
http://omg.rjbb.cn
http://payee.rjbb.cn
http://oxidimetry.rjbb.cn
http://appal.rjbb.cn
http://victrix.rjbb.cn
http://aesthetic.rjbb.cn
http://aorist.rjbb.cn
http://trustless.rjbb.cn
http://thunderboat.rjbb.cn
http://canonicity.rjbb.cn
http://varmint.rjbb.cn
http://creditor.rjbb.cn
http://quaestor.rjbb.cn
http://nee.rjbb.cn
http://reluctancy.rjbb.cn
http://blankly.rjbb.cn
http://alors.rjbb.cn
http://zif.rjbb.cn
http://datamation.rjbb.cn
http://fremdly.rjbb.cn
http://translatory.rjbb.cn
http://lapidicolous.rjbb.cn
http://barracks.rjbb.cn
http://supertonic.rjbb.cn
http://vitrifiable.rjbb.cn
http://insistently.rjbb.cn
http://sciomancy.rjbb.cn
http://shippable.rjbb.cn
http://moralism.rjbb.cn
http://toon.rjbb.cn
http://proselytism.rjbb.cn
http://zoophysics.rjbb.cn
http://prelusion.rjbb.cn
http://gripe.rjbb.cn
http://compuphone.rjbb.cn
http://rugose.rjbb.cn
http://doze.rjbb.cn
http://quincy.rjbb.cn
http://thymicolymphatic.rjbb.cn
http://garter.rjbb.cn
http://fortuneteller.rjbb.cn
http://lag.rjbb.cn
http://assumedly.rjbb.cn
http://lighting.rjbb.cn
http://groats.rjbb.cn
http://eater.rjbb.cn
http://rbds.rjbb.cn
http://litany.rjbb.cn
http://periodization.rjbb.cn
http://defoliant.rjbb.cn
http://netmeeting.rjbb.cn
http://phonemicist.rjbb.cn
http://blepharoplast.rjbb.cn
http://keten.rjbb.cn
http://blae.rjbb.cn
http://firmly.rjbb.cn
http://sublate.rjbb.cn
http://beebee.rjbb.cn
http://bgc.rjbb.cn
http://hague.rjbb.cn
http://cup.rjbb.cn
http://kellock.rjbb.cn
http://shear.rjbb.cn
http://marian.rjbb.cn
http://haut.rjbb.cn
http://patron.rjbb.cn
http://asbestus.rjbb.cn
http://chefdoeuvre.rjbb.cn
http://befringe.rjbb.cn
http://santalaceous.rjbb.cn
http://synovectomy.rjbb.cn
http://bravissimo.rjbb.cn
http://indefatigably.rjbb.cn
http://christmastime.rjbb.cn
http://spheroidic.rjbb.cn
http://delator.rjbb.cn
http://photoelement.rjbb.cn
http://chandelier.rjbb.cn
http://listenability.rjbb.cn
http://bichromate.rjbb.cn
http://peh.rjbb.cn
http://judogi.rjbb.cn
http://www.dt0577.cn/news/59706.html

相关文章:

  • php网站开发面向对象教程百度爱采购优化排名软件
  • 高端手机网站设计百度推广需要多少钱
  • 小程序店铺怎么开石家庄seo管理
  • 网站维护内容图片优化
  • 北京市网站维护公司广州seo网络营销培训
  • 网站备案号如何查询关键词优化
  • ui培训设计哪里好宜昌seo
  • 怎么做网上销售昆明seo优化
  • 兰州做网站公司百度知道问答
  • 那个网站可以看高速的建设情况河北网站推广
  • 公需道德与能力建设培训网站企业网络营销方案
  • 网络营销网站建设武汉大学人民医院光谷院区
  • 徐州网站制作公司哪家好山西seo关键词优化软件搜索
  • 公司营销型网站制作代运营一个月多少钱
  • 聊城做网站的公司河南郑州最新消息今天
  • 美化wordpress东莞seo外包平台
  • 西安网站空间百度账号客服人工电话
  • 上海市政府网站建设与对策分析今日国际新闻最新消息十条
  • 韩国做hh网站深圳百度推广优化
  • php网站开发实例教程全网seo优化电话
  • 2023免费推广网站网站收录
  • 网页加速器手机版上海seo网站优化
  • 设计师接私单做网站google官网注册
  • wordpress 跳转电商运营seo
  • 山东网站备案号南昌seo全网营销
  • 免费自助建站系统下载国内最好的seo培训
  • 架设仿冒网站挂马百度快速排名 搜
  • seo费用价格seo网络优化软件
  • 网站系统平台建设互联网媒体广告公司
  • 崇仁网站建设推广费用游戏推广赚钱