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
hdu1175
hdu1175
(dfs+剪枝)
http://acm.split.hdu.edu.cn/showproblem.php?pid=1175连连看TimeLimit:20000/10000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):34950AcceptedSubmission(s):8688ProblemDescription“连连看
ACZone
·
2023-11-03 12:02
dfs
acm
dfs
hdu
【
hdu1175
】连连看——dfs(剪枝)
题目:连连看TimeLimit:20000/10000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):27462AcceptedSubmission(s):6809ProblemDescription“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如
CFhM_R
·
2022-07-28 07:36
题解心得
dfs
hdu
dfs
(bfs)连连看(
hdu1175
)
题目:“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就只能将错就错了,连线不能从外围绕过。玩家鼠
_jym
·
2020-06-25 18:11
acm练习(c++/c)
HDU1175
- 连连看 - 不好写
PS:这一题也是写了二十多遍了,去年这个时候写的,也是写了几天。过几天等考试结束了,集训的时候重新把几种方法再写一下!题意:中文题,自行理解。思路:三维+优先队列写的,跑的时间是最短的,780ms。dfs+剪枝+判断方向是否改变。跑了辣么长时间6895ms。PS:flag标记判断方向就行了。三维+优先队列写的,跑的时间是最短的,780ms。//三维+优先队列#include#include#inc
抓水母的派大星
·
2020-06-22 22:00
ACM 搜索
hdu1175
连连看
ProblemDescription“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就只能将错就错
Little_boy_z
·
2016-05-14 10:00
hdu1175
连连看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1175写了10次,才对。。。代码都应该很清楚了。一个dfs函数就可以了,参数记录了方向,转弯次数。代码:#include #include inta[1005][1005]; intv[1005][1005]; intn,m; intx1,y1,x2,y2; intdx[]={-1,0,1,0};
wsn564533648
·
2016-05-04 20:00
ACM
DFS
HDU1175
:连连看(DFS)
ProblemDescription“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就只能将错就错
qq_27601815
·
2016-05-02 14:00
DFS
HDU1175
连连看【搜索】【剪枝】
连连看TimeLimit:20000/10000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):26540 AcceptedSubmission(s):6590ProblemDescription“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多
wlx65003
·
2016-01-03 15:00
编程
C++
算法
ACM
DFS
【ACM】连连看
hdu1175
此题需要注意: 1.不能从外围绕过。 2.有可能询问的两个点都是空点。 1 #include <cstdio> 2 #include <cstring> 3 #include <math.h> 4 using namespace std; 5 6 const int MAXN=1000+5; 7 const int INF=1
·
2015-11-13 12:05
ACM
HDU1175
+ HDU1728+BFS转弯
HDU1175
View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h
·
2015-11-13 05:35
HDU
hdu 1175 连连看
开始用优先队列广搜,WA,跟海峰讨论了一下,发现只要一次走一行,就可以只用普通队列即可,又是一道泪流满面的题目啊~~~~~ /* *
hdu1175
/win.cpp * Created on: 2011
·
2015-11-11 15:42
HDU
行坐标
HDU1175
:连连看(DFS)
最近研究行坐标,稍微总结一下,以后继续补充: Problem Description “连连看”相信很多人都玩过。没玩过也没关系,上面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超越两次,那
·
2015-10-31 15:04
HDU
【搜索】[
HDU1175
]连连看
题目分析:这道题看到的第一反应应该就是BFS或者DFS,裸的DFS、BFS显然会TLE,所以我就想用A*,不过好像并不好写启发函数。枚举步数不行,就枚举边吧。因为允许有两次转折,所以最多有三条边枚举中间的一条边,然后进行check,这道题只用了两个for循环就AC了。代码:#include #include #include usingnamespacestd; #defineMAXN1000 i
outer_form
·
2015-08-26 20:00
C++
搜索
astar
noip
hdu1175
连连看(DFS+剪枝)
连连看TimeLimit:20000/10000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):25111 AcceptedSubmission(s):6211ProblemDescription“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多
su20145104009
·
2015-08-24 10:00
HDU
连连看
1175
hdu1175
DFS+J剪枝
hdu1175
(连连看)
点击打开链接ProblemDescription“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就
u011479875
·
2015-08-08 01:00
HDU 1728 逃离迷宫
pid=1728这道题和
hdu1175
很相似,所以直接把1175这题的代码那过来修改,可是一直WA,按理说不应该WA的。。。。
tenlee
·
2014-07-29 13:00
ACM-搜索之连连看——
hdu1175
连连看ProblemDescription“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就只能将
lx417147512
·
2014-03-26 08:00
搜索
ACM
连连看
hdu1175
HDU 1175 BFS
/* *
HDU1175
*fuqi
i_fuqiang
·
2013-07-30 21:00
HDU1175
:连连看(DFS)
ProblemDescription“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就只能将错就错
libin56842
·
2013-05-30 17:00
HDU
DFS
解题报告
HDU1175
连连看 DFS
题目大意:除了不能出界,其余就像玩游戏一样.思路:有几个注意的地方:(1)如果是给出同一点的判断能否抵消的,答案应该是否(2)如果两点不相等的话也不行(3)如果两点都是0的话也不行我是用DFS做得,一开始TLE,后来有一个犀利的剪枝,200ms.NICE.剪枝就是考虑在成功之前的状态:如果转折数已经达到2,但是还没有到达目的地,这应该要跳出.(成功与失败就在一线之差!)我是这样判断拐角的:建立两个
kg_second
·
2013-03-28 15:00
HDU1175
连连看
HDU1175
题目描述BFS#include #include #include usingnamespacestd; intmap[1010][1010]; intn,m; intex,ey; //
mxway
·
2012-12-20 09:00
hdu1175
(连连看)
#include#include#includeusingnamespacestd;constintmaxn=1010;constintINF=5;intn=0,m=0,q=0;intmap[maxn][maxn];intx1=0,y1=0,x2=0,y2=0;intdr[4][2]={{0,1},{0,-1},{-1,0},{1,0}};// E W
wangwenhao00
·
2012-09-26 22:00
list
struct
include
hdu1175
/*分析: 简单深搜,62MS。 因为转折数不能超过两次,所以对于1000*1000的,不出意外深搜可行。犯2了。。。一开始传递的d=-1,所以代码行49里面,应该是“if(i!=d&&d!=-1)”而不是“if(i!=d)”,白WA了好几次。记性真差,以后将有必要的点儿都写下来,记一下,要不再犯这种错误,而且没有检查出来,不是2死了么。。。 没啥说的,对于搜索还是要注意剪枝吧,这个很~重
Ice_Crazy
·
2012-04-25 17:00
搜索BFS
HDU1175
连连看http://acm.hdu.edu.cn/showproblem.php?
shuangde800
·
2012-03-17 11:00
c
struct
Path
IM
HDU 1175 连连看
代码:/*
HDU1175
连连看 Tips:搜索+剪枝 */ #include #include intn,m,q,tr,tc,sr,sc; intmap[1005][1005]; intvis[1005
ivan_zjj
·
2011-11-21 23:00
HDU1175
连连看 模拟搜索
刚开始写的有点恶心,认为要分为三种情况,所以哗啦啦地写了两种。写第三种的时候发现原来全部都可以归结为第三种,即用三根折线连起来的情况。 【思路】 首先,若两点坐标相同,返回NO。若两点值不同,返回NO。若有一个点为0,返回NO。水平方向,分别从两个点向两边寻找最大的可占用的空间(为0的点),分别得到两个区间,然后取两个区间的交集。枚举交集中的每两个在同一竖直方向的点,如果它们之间的点均为0,即可
Human_CK
·
2011-11-07 20:00
HDU1175
连连看
连连看 Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6496 Accepted Submission(s): 1660 Problem Descrip
Dev|il
·
2011-09-09 23:00
HDU
hdu1175
——连连看
纠结于dfs没过,经剪枝了下,过了。 不过 时间达到了令人恐怖的9625ms。 #include<iostream> #include<cstring> #include<cstdio> using namespace std; int dir[][2]={{0,-1},{-1,0},{0,1},{1,0}}; int map[1001][1001]; bo
44424742
·
2011-03-19 21:00
J#
hdu1175
——连连看
bfs思路。 加一个mark数组,用来判断是否入队。其初始化为3。 注意一点:如果想用取余来判断转向的话,很容易错,会把反方向当做不变。 #include<iostream> #include<cstring> #include<cstdio> using namespace std; int g[1005][1005]; int dir[][2]={{0
44424742
·
2011-03-19 21:00
J#
hdu 1175 连连看
hdu1175
连连看#include #define MAXN 1001#include using namespace std;int mat[MAXN][MAXN];int mark[MAXN][MAXN
misschuer
·
2011-03-17 12:00
HDU 1175 连连看
HDU1175
连连看主要在于判断转折了几次。
心如止水
·
2011-03-01 11:00
hdu1175
连连看
一道类似于1728逃离迷宫的广搜题,同样是在结构中增加方向(dir)、转弯数(turn)两个变量,话不多说,要注意的是重复遍历,所以后面再次搜索到这个点时所消耗的时间一定会比经历此点最大的时间还要长,所以剩余时间一定要比最大的时间还要大才行,否则无法抵达。
zhang360896270
·
2011-02-10 17:00
hdu1175
hdu1175BFS. 题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=1175由于bfs按层次进行搜所,得到的是从起点到终点的最短路径,但是题目要求我们找一条转向不超过2次的.因此我们可以在此基础上加上一个记录转向次数的数组.对于那些被扩展的点,如果它的转向次数小于等于数组记录的值,那么还可以再次入队列.如下面一组数据:1110110001202
寒月
·
2010-08-21 11:00
HDU1175
HDU1175#include #include #include const int N = 1005;int n, m;int map[N][N];int x1, y1, x2, y2;int r[N][N], c[N][N];bool solve() { int s1 = (map[x1][y1]!=0), s2 = (map[x2][y2]!=0) ; if( x1 == x2
学习心得(code)
·
2010-07-30 15:00
上一页
1
下一页
按字母分类:
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
其他