E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Tempter
HDUOJ-1010
Tempter
of the Bone(深搜+剪枝优化)
一开始没仔细看题(英文渣),一扫样例,这不广搜嘛,然后血崩。认真翻译了一遍。然后用深搜写,然后在一个小错误上面卡了4个小时。。终于AC了。。其实个人感觉用广搜也不是不可以,只是超时。。思路递归函数:模拟每一步状态,递归函数开头写终止条件,然后更新坐标值,判断是否是墙或走过的路,然后把坐标代入下一层递归。剪枝1、这里的MinStep为曼哈顿距离“两点在南北方向上的距离加上在东西方向上的距离”,是本题
叽翅
·
2023-01-26 13:21
hdu1010
Tempter
of the Bone —— dfs+奇偶性剪枝
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1010代码如下:#include//hdu1010dfs+奇偶性剪枝#includecharmap[10][10];intn,m,t,wall,si,sj,di,dj;intd[4][2]={{0,1},{0,-1},{1,0},{-1,0}};intdfs(inti,intj,intstep){if(
DOLFAMINGO
·
2022-11-09 04:53
DFS
HDU 1010
Tempter
of the Bone 解题报告
TempteroftheBone问题模型迷宫问题。由起始位置出发t秒时能否到达出口。每秒可以从当前位置沿上、下、左、右四个方向移动一步。解题报告dfs+剪枝/*基础搜索题,dfsdfs的思想是比较直观的,如果不加以剪枝这题的所有状态为4^(n*m),很小的规模(本题中01或1->0必然是奇数步0->0或1->1必然是偶数步结论:当遇到从0走向0但是要求时间是奇数的,或者,从1走向0但是要求时间是偶
Lur
·
2020-09-15 13:26
搜索
c
hdu 1010
Tempter
of the Bone 简单带回溯的dfs+奇偶剪枝
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1010题意:有一只小狗需要从N*M迷宫里逃离,出发点标记为'S','X'为不可走,'D'为出口,出口是一扇门,只有在T时刻才打开。问小狗能否逃离迷宫?T(1#include#include#include#include#include#includeusingnamespacestd;#definea
PoemK
·
2020-09-14 05:08
ACM_搜索
奇偶剪枝***&&***HDU1010
Tempter
of the Bone
LinkHere:*****奇偶原理详解LinkHere:*****HDU1010奇偶剪枝描述奇偶剪枝是数据结构的搜索中,剪枝的一种特殊小技巧。现假设起点为(sx,sy),终点为(ex,ey),给定t步恰好走到终点,s|||+———e如图所示(“|”竖走,“—”横走,“+”转弯),易证abs(ex-sx)+abs(ey-sy)为此问题类中任意情况下,起点到终点的最短步数,记做step,此处step
YouthDance
·
2020-08-26 14:21
搜索
【HDU 1010】顺序刷题
Tempter
of the Bone (dfs 奇偶剪枝)
题目大意给出一张n∗mn*mn∗m的图,图中标有起始点SSS,终点DDD,和不能走的墙XXX。问是否可以恰好走k步从起点走到终点(不能走重复的点)。解题思路一开始以为是bfs,但是这个就算地图状态可以状压,状态数也还是太多了,所以广搜明显是不行的。后来转到dfs,考虑剪枝。最基础的可行性剪枝->如果现在剩余的可走步数已经严格小于当前位置和终点位置的曼哈顿距离,则剪掉,不过这个剪枝的效果并不够好。稍
yashem66
·
2020-08-26 13:40
Tempter
of the Bone
http://acm.hdu.edu.cn/showproblem.php?pid=1010题意:在一个N,M的的迷宫中给定一个t,问能否恰好在t步从s到达d,其中x是不可到达点,且走过的点不能重复;#include#include#includeintn,m,t,Sx,Sy,Dx,Dy;charMap[10][10];constintstep[4][2]={{-1,0},{0,1},{1,0},
AC1048900581
·
2020-08-20 02:50
ACM
Tempter
of the Bone
TimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):108022AcceptedSubmission(s):29364ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.H
weixin_30567225
·
2020-08-10 22:34
【杭电oj】1010 -
Tempter
of the Bone(dfs,奇偶剪枝,好题)
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):97047AcceptedSubmission(s):26333ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfasc
wyg1997
·
2020-08-04 08:18
错题本
DFS&BFS
剪枝
杭电OJ(HDOJ)1010题:
Tempter
of the Bone(DFS,迷宫求解)
题意:一只狗为了一根骨头,陷入一个迷宫当中,必须要在时间T这一时刻逃到出口,走一步花一分钟,要刚好在T分钟到达出口。给出三个整数:n(1usingnamespacestd;intn;//迷宫行数intm;//迷宫列数intt;//规定的分钟数intflag[10][10];//用于标记格子是否被访问charmap[10][10];//地图boolsuccess;//标记出口是否找到voidVisi
大块木
·
2020-08-04 03:13
ACM
ACM
杭电OJ:1010
Tempter
of the Bone
这是一道搜索的题目,题目很常规,需要注意的是剪枝函数,如果剪纸剪的不好就很容易超时。AC代码:#includecharmaze[8][8];intn,m,t;boolsuccess;intgo[][2]={1,0,-1,0,0,1,0,-1};voidDFS(intx,inty,inttime){for(inti=0;i=n||ny=m)continue;if(maze[nx][ny]=='X')
堕落的蚂蚁
·
2020-08-04 01:26
算法
杭电OJ
搜索
【hdoj_1010】
Tempter
of the Bone(迷宫+剪枝)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1010题目大意:给出一个迷宫(含起点和终点),要求找出一条路径,这条路径的长度必须为某个规定的长度.在做本题之前,先学习了一下迷宫问题:http://blog.csdn.net/ten_sory/article/details/66975811在理解迷宫问题的基础上,再做本题.本题的难点就是剪枝的问题.如果
tensory.online
·
2020-08-04 01:07
算法OJ
HDOJ-1010
Tempter
of the Bone
深度搜索DFS常常需要与奇偶性剪枝一块用#include#include#include#include#include#include#includeusingnamespacestd;intsx,sy,ex,ey,n,m,t;intflag;charmap[10][10];intvis[10][10];intdir[4][2]={{-1,0},{1,0},{0,1},{0,-1}};voidD
0427-qzb
·
2020-08-03 23:13
DFS
ACM搜索:杭电oj1010
Tempter
of the Bone
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1010题意就是小狗在迷宫迷路.判断小狗能否在指定t时间.刚好到达指定地点.由于是判断是否存在的问题.我才用了dfs深度遍历.AC代码:#include#include#include#include#include#include#include#includeusingnamespacestd;#d
闭上左眼看世界
·
2020-08-03 22:45
ACM_搜索遍历
hdoj-1010-
Tempter
of the Bone【深搜+剪枝】
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):90097AcceptedSubmission(s):24482ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfasc
凌摩绛霄
·
2020-08-03 21:49
搜索
杭电1010-
Tempter
of the Bone(BFS)
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):91716AcceptedSubmission(s):24937ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfasc
Eric_keke
·
2020-08-03 20:05
深度优先搜索
杭电OJ——
Tempter
of the Bone
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,themazebegan
iteye_18800
·
2020-08-03 18:52
杭电ACM 1010
Tempter
of the Bone
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):120163AcceptedSubmission(s):32462ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfas
SimonHu-real
·
2020-08-03 17:14
修炼之路
杭电oj1010题:
Tempter
of the Bone
Thedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,themazebegantoshake,andthedoggiecouldfeelthegroundsinking.Herealizedthatthebonewasatrap,andhetrieddesperatelytogetout
blingzlh
·
2020-08-03 15:48
杭电oj
【杭电oj1010 】-
Tempter
of the Bone(dfs,奇偶剪枝)
TempteroftheBoneTempteroftheBoneTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):127135AcceptedSubmission(s):34284ProblemDescriptionThedoggiefoundaboneinananci
RRicky_
·
2020-08-03 13:26
dfs&bfs
HDOJ 1010:
Tempter
of the Bone 迷宫问题 解题报告
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):30012AcceptedSubmission(s):8167ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfasci
PythonFX
·
2020-08-03 13:10
ACM解题报告
搜索问题
HDOJ-1010
Tempter
of the Bone
DFS深度搜索,常常跟奇偶剪枝一块用#include#include#include#include#include#include#includeusingnamespacestd;intsx,sy,ex,ey,n,m,t;intflag;charmap[10][10];intvis[10][10];intdir[4][2]={{-1,0},{1,0},{0,1},{0,-1}};voidDFS
导士
·
2020-08-03 10:05
DFS
搜索
acm
Tempter
of the Bone (深搜+剪枝)
第一次遇到剪枝这一概念,主要是用来减少步骤的吧,WA了十四次尴尬H-TempteroftheBoneTimeLimit:1000MSMemoryLimit:32768KB64bitIOFormat:%I64d&%I64uSubmitStatusDescriptionThedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,w
yinghui970828
·
2020-07-15 11:39
搜索
Tempter
of the Bone hdu 1010 (奇偶剪枝)
ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,themazebegantoshake,andthedoggiecouldfeelthegroundsinking.Herealizedthatthebonewasatrap,andhetriedd
KEMNHan
·
2020-07-15 06:34
题目
hdu
hdu 2128
Tempter
of the Bone II ( bfs+不好搞的判重 )
TempteroftheBoneIITimeLimit:10000/5000MS(Java/Others)MemoryLimit:98304/32768K(Java/Others)TotalSubmission(s):1128AcceptedSubmission(s):282ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfasc
utobe67
·
2020-07-05 15:09
搜索
杭电acm1010
Tempter
of the Bone
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):133177AcceptedSubmission(s):35811ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfas
cwhong
·
2020-03-03 02:53
HDU1010 ---
Tempter
of the Bone(dfs+剪枝)
小明做了一个很久很久的梦,醒来后他竟发现自己和朋友在一个摇摇欲坠的大棋盘上,他们必须得想尽一切办法逃离这里。经过长时间的打探,小明发现,自己所在的棋盘格子上有个机关,上面写着“你只有一次机会,出发后t秒大门会为你敞开”,而他自己所在的棋盘是大小为N*M的长方形,他可以向上下左右四个方向移动(不可走有障碍点)。棋盘中有一扇门。根据机关的提示,小明顿时明白了,他和朋友必须在第t秒到门口。而这一切,没有
qdu_lkc
·
2020-01-28 20:00
HDU1010
Tempter
of the Bone DFS、剪枝
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):166686AcceptedSubmission(s):44241ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfas
DouglasConnor
·
2019-08-24 23:46
HDU
DFS
HDU1010
Tempter
of the Bone DFS、剪枝
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):166686AcceptedSubmission(s):44241ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfas
DouglasConnor
·
2019-08-24 23:46
HDU
DFS
【题解】
Tempter
of the Bone HDU - 1010 ⭐⭐【经典问题 奇偶性剪枝】
暑假的时候,小明和朋友去迷宫中寻宝。然而,当他拿到宝贝时,迷宫开始剧烈震动,他感到地面正在下沉,他们意识到这是一个陷阱!他们想尽一切办法逃出去。迷宫是一个大小为N*M的长方形,迷宫中有一扇门。一开始,门是关着的,他会在第t秒的时间打开。因为,小明和朋友必须在第t秒到大门口。每一秒,他都可以向上下左右四个方向移动一个点。一旦他移动了,他刚才所在的点就消失,(这意味着他不能回到他已经走过的点)。他不能
Suprit
·
2019-05-05 13:57
搜索
HDU 1010
Tempter
of the Bone (DFS+剪枝(奇偶剪枝原理))
题意:根据地图,'S'为开始位置,'D'为门的位置,'.'为空地,'X'为墙,不能经过,问:在指定的时间,是否能到达'门'的位置.注意:路不可以重复经过,时间也要刚好是t,不能少.思路:因为是查找距离为t的路径,所以不能用bfs。朴素的dfs肯定会TLE,这里需要剪枝:1.奇偶剪枝。两点的曼哈顿距离是最短距离,任意一条路径长度要与最短距离同奇偶,所以两者差值要为偶数,这主要体现在每一次递归判断t-
Dilly__dally
·
2018-11-24 21:35
DFS
HDU 1010
Tempter
of the Bone (DFS+剪枝(奇偶剪枝原理))
题意:根据地图,'S'为开始位置,'D'为门的位置,'.'为空地,'X'为墙,不能经过,问:在指定的时间,是否能到达'门'的位置.注意:路不可以重复经过,时间也要刚好是t,不能少.思路:因为是查找距离为t的路径,所以不能用bfs。朴素的dfs肯定会TLE,这里需要剪枝:1.奇偶剪枝。两点的曼哈顿距离是最短距离,任意一条路径长度要与最短距离同奇偶,所以两者差值要为偶数,这主要体现在每一次递归判断t-
Dilly__dally
·
2018-11-24 21:35
DFS
D -
Tempter
of the Bone -曼哈顿距离+奇偶剪枝
D-TempteroftheBoneHDU-1010#include#include#includeusingnamespacestd;#definemaxn25intto[5][2]={{0,1},{0,-1},{1,0},{-1,0}};charmmp[maxn][maxn];boolvis[maxn][maxn];intsx,sy,n,m,t,ex,ey,d,flag;voiddfs(int
SDUTACMer_亓玉宁
·
2018-09-18 15:28
搜索进阶
hdu1010
Tempter
of the Bone 深搜dfs(论代码规范的重要性)
B-TempteroftheBoneHDU-1010Thedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,themazebegantoshake,andthedoggiecouldfeelthegroundsinking.Herealizedthatthebonewasatrap,and
cloudy_happy
·
2018-08-01 17:49
dfs深搜
还需再写一遍
Tempter
of the Bone (深搜+剪枝+回溯)
Thedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,themazebegantoshake,andthedoggiecouldfeelthegroundsinking.Herealizedthatthebonewasatrap,andhetrieddesperatelytogetout
君卿
·
2018-08-01 16:44
dfs
Tempter
of the Bone dfs
Thedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,themazebegantoshake,andthedoggiecouldfeelthegroundsinking.Herealizedthatthebonewasatrap,andhetrieddesperatelytogetout
Cworld2017
·
2018-07-27 21:34
dfs
hdoj1010
Tempter
of the Bone(迷宫问题dfs,奇偶剪枝)
迷宫问题。这类问题接触的少,但仔细审题就能看出要用dfs。欢天喜地写出代码,结果超时了。百度了一下,惊讶的发现差了从没听过的奇偶剪枝操作。代码有借鉴的地方。#include#include#includeusingnamespacestd;intn,m,t;charmaze[8][8];intv[8][8];intd[4][2]={-1,0,1,0,0,-1,0,1};intb_x,b_y,e_x
CqZtw
·
2017-05-18 20:31
oj
(HDU
Tempter
of the Bone II) BFS + 可捡炸弹炸墙的迷宫问题
TempteroftheBoneIITimeLimit:10000/5000MS(Java/Others)MemoryLimit:98304/32768K(Java/Others)TotalSubmission(s):1090AcceptedSubmission(s):272ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfasc
STILLxjy
·
2017-05-17 23:00
HDU 1010 ——
Tempter
of the Bone DFS+剪枝
原题:http://acm.hdu.edu.cn/showproblem.php?pid=1010题意:从S走到D,其中X是墙,不能走;给定时间t,问能否从S到D正好花费t时间(一步即为一秒);思路:用DFS+剪枝;此处有两种剪枝:1、从S到D的最短时间是tmp=abs(sx-dx)+abs(sy-dy),如果tmp>t,显然是“NO”;2、如果tmpusingnamespacestd;const
0x3f3f3f3f
·
2017-02-09 16:27
dfs
DFS
HDOJ/HDU
Tempter
of the Bone(深搜+奇偶性剪枝)
ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,themazebegantoshake,andthedoggiecouldfeelthegroundsinking.Herealizedthatthebonewasatrap,andhetriedd
qq_26525215
·
2016-07-04 14:00
ACM
深搜
HDU 1010
Tempter
of the Bone【经典DPS】
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):90627 AcceptedSubmission(s):24657ProblemDescriptionThedoggiefoundaboneinanancientmaze,w
qq_24653023
·
2016-07-03 23:00
ACM
HDU
dfs:
Tempter
of the Bone剪枝
DescriptionThedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,themazebegantoshake,andthedoggiecouldfeelthegroundsinking.Herealizedthatthebonewasatrap,andhetrieddesperat
Davenny
·
2016-07-03 17:42
HDU 1010
Tempter
of the Bone (DFS+剪枝)
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):103212 AcceptedSubmission(s):27988ProblemDescriptionThedoggiefoundaboneinanancientmaze,
liangzhaoyang1
·
2016-05-27 19:00
HDU
of
the
1010
Bone
Tempter
DFS+剪枝
ACM 搜索 hdu1010
Tempter
of the Bone
ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,themazebegantoshake,andthedoggiecouldfeelthegroundsinking.Herealizedthatthebonewasatrap,andhetriedd
Little_boy_z
·
2016-05-14 09:00
hdu——1010
Tempter
of the Bone
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):102253 AcceptedSubmission(s):27703ProblemDescriptionThedoggiefoundaboneinanancientmaze,whic
shadowcw
·
2016-05-11 22:00
C++
dp
HDU
Tempter
of the Bone —HDU1010(DFS+剪枝)
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):102071 AcceptedSubmission(s):27649ProblemDescriptionThedoggiefoundaboneinanancientmaze,
Jelly_acm
·
2016-05-06 09:00
ZOJ2110
Tempter
of the Bone(DFS模板题,迷宫问题)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2110题意:一只小狗在一个古老的迷宫里找到一根骨头,当它叼起骨头时,迷宫开始颤抖,它感觉到地面开始下沉。它才明白骨头是一个陷阱,它拼命地试着逃出迷宫。 迷宫是一个N×M大小的长方形,迷宫有一个门。刚开始门是关着的,并且这个门会在第T秒钟开启,门只会开启很短的时间(少
u011523762
·
2016-05-05 19:00
DFS
HDU1010:
Tempter
of the Bone(DFS)
ProblemDescriptionThedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,themazebegantoshake,andthedoggiecouldfeelthegroundsinking.Herealizedthatthebonewasatrap,andhetriedd
qq_27601815
·
2016-05-03 20:00
DFS
HDU1010-
Tempter
of the Bone
A- TempteroftheBoneTimeLimit:1000MS MemoryLimit:32768KB 64bitIOFormat:%I64d&%I64uSubmit StatusDescriptionThedoggiefoundaboneinanancientmaze,whichfascinatedhimalot.However,whenhepickeditup,them
a664607530
·
2016-04-28 20:00
HDU 1010
Tempter
of the Bone(DFS,奇偶剪枝)
TempteroftheBoneTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):101688 AcceptedSubmission(s):27539ProblemDescriptionThedoggiefoundaboneinanancientmaze,
hurmishine
·
2016-04-26 23:00
of
the
Bone
hdu1010
Tempter
上一页
1
2
3
4
5
6
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他