![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
BFS
文章平均质量分 84
sdau_blue
念念不忘,必有回响。驰而不息,功不唐捐。
展开
-
倒水——bfs
Pots Time Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other) Total Submission(s) : 100 Accepted Submission(s) : 30 Special Judge Problem Description You are given t原创 2017-08-05 21:24:31 · 222 阅读 · 0 评论 -
简单bfs+pair的用法
链接:https://www.nowcoder.com/acm/contest/106/J来源:牛客网It’s universally acknowledged that there’re innumerable trees in the campus of HUST.And there are many different types of trees in HUST, each of whic...原创 2018-04-30 09:40:14 · 253 阅读 · 0 评论 -
hihocoder1426—What a Ridiculous Election(bfs预处理)
题目大意: 1.交换相邻的数字 2.每个位置+1(最多操作3次) 3.每个位置乘以2(最多操作2次) 然后开始是12345,给了五位数n,然后问12345转化成n最小操作几步。如果不能输出-1 解: 用bfs,模拟出所有的12345变换情况,开个三维数组 m[x][y][z] ,表示12345变换成x,②用了y次,③用了z次时的最少步数; 代码: #include<bit...原创 2018-10-04 20:33:00 · 198 阅读 · 0 评论 -
UVA 11624 (BFS)
题目:一个平面迷宫中有一个人,迷宫中有些点起火了,火和人每个单位时间只能向相邻的格子移动, 其中有一些空间被墙壁占据,问这个人在不背或烧到的情况下,离开迷宫的最快时间。 分析:搜索。迷宫中的最短路,首先就会想到bfs;并且bfs利用队列会使状态空间按时间顺序分层。 而火的扩散过程正好符合这个时间的层次。所以我们会想到,利用两个队列,一个储存人的状态,...原创 2018-10-13 20:25:16 · 90 阅读 · 0 评论 -
D. Labyrinth(bfs+记忆化)
D. Labyrinth time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output You are playing some computer game. One of its levels puts you in a ...原创 2018-10-16 15:02:34 · 475 阅读 · 0 评论 -
函数的魔法(水)
链接:https://ac.nowcoder.com/acm/contest/326/C 来源:牛客网 一位客人来到了此花亭,给了女服务员柚一个数学问题:我们有两个函数,F(X)函数可以让X变成(X*X*X+X*X)mod 233。G(X)函数可以让X变成(X*X*X-X*X)mod 233,我们可以任意的对A使用F(X),和G(X),问最少需要多少次使用这两个函数让A变成B。 输入描述:...原创 2018-12-30 10:20:59 · 146 阅读 · 0 评论