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
hdu1241
hdu1241
dfs连通块问题
OilDepositsTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):3087AcceptedSubmission(s):1765ProblemDescriptionTheGeoSurvCompgeologicsurveycompanyisresponsiblefor
天涯with0
·
2023-11-24 21:00
dfs水题
hdu1241
—是什么让一个植物人从b站中惊醒
是这该死的生活,要恰饭的嘛OilDepositsTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):48272AcceptedSubmission(s):27768ProblemDescriptionTheGeoSurvCompgeologicsurveycompanyi
屁话很多的美妆博主
·
2020-09-15 03:33
hdu1241
简单搜索题
hdu1241#includeusingnamespacestd;chararea[110][110];intflag[110][110];intanext[8][2]={{1,1},{1,0},{1,-1},{-1,1},{-1,0},{-1,-1},{0,1},{0,-1}};inta,b;voiddfs(inti,intj){for(intk=0;k=0&&ii=0&&jj>a>>b&&a!
werdery
·
2020-09-14 05:51
acm竞赛
dfs
算法
动态规划--
hdu1241
搬寝室
一共n间物品,每次搬2个,一共搬k次,疲劳度为每次2个物品重量差的平方和,求最小疲劳度。1.a#include#include#includeusingnamespacestd;constintmaxn=2005;intdp[maxn][maxn],num[maxn];constintINF=1=2*j){dp[i][j]=min(dp[i-2][j-1]+sum2(num[i-1],num[i]
Falling~
·
2020-09-14 03:44
动态规划
HDU1241
DFS/BFS 求连通块
0)遍历所有点,求出连通块的数量,每到一块油田,就采用DFS或者BFS消除该油田以及附近连通的油田。注意(易错):①二维数组mat[i][j],i是第几行,j是第几列,所以搜到一点再搜该点周围八个方位(+dir[i][j])时,以及确定是否超出地图范围时,注意i是纵向加减,j是横向加减,且(0,0)原点在左上角,向右向下坐标的值都是不断递增。②scanf("%c",&mat[i][j]);,sca
嚜寒
·
2020-09-14 03:22
ACM
图论
HDU1241
求联通块个数(DFS)
每日打卡(1/1)传送门:点击打开链接题目大意:求联通块个数思路:把n*m的图完整遍历一遍,如果遇到一个点是@,那么就搜索当前点,将和其所有联通的点全部改为‘*’,并且总数+1,然后就求出了联通块的个数。代码:#include#include#include#include#includeusingnamespacestd;constintmaxn=105;chars[maxn][maxn];in
总想玩世不恭
·
2020-09-12 08:27
暴力
搜索与递归
hdu1241
Oil Deposits
OilDepositsTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):11512AcceptedSubmission(s):6699ProblemDescriptionTheGeoSurvCompgeologicsurveycompanyisresponsiblefo
my1995
·
2020-08-17 01:23
深度优先搜索
hdu1241
——Oil Deposits(广搜的简单应用)
这道题,求的是油矿!关键是有相邻的话,要归并为一个油矿!对此,我们对每个点进行遍历,如果这个点还没进行过bfs,且它是一个油矿,那么,对其标记为已经bfs,并对其为起点bfs,遍历过的且为油矿的点,标记为已bfs。其中,设置一个计数,用来记录有多少个点进行过bfs,即为题目所求!#include#include#definemax105charg[max][max];intn,m,used[max
lazy_virus
·
2020-07-29 19:29
HDU1241
POJ1562 UVa572 UVALive5317 Oil Deposits【DFS】
OilDepositsTimeLimit:1000MSMemoryLimit:10000KTotalSubmissions:17768Accepted:9440DescriptionTheGeoSurvCompgeologicsurveycompanyisresponsiblefordetectingundergroundoildeposits.GeoSurvCompworkswithonelar
海岛Blog
·
2020-07-08 07:17
#
ICPC-备用二
#
ICPC-UVA
#
ICPC-HDU
#
ICPC-POJ
#
ICPC-ZOJ
#
ICPC-UVALive
#
ICPC-DFS
HDU1241
Oil Deposits(dfs+连通块问题)
背景描述ztw同志负责探测地下石油储藏.ztw现在在一块矩形区域探测石油.他通过专业设备,来分析每个小块中是否蕴藏石油.如果这些蕴藏石油的小方格相邻(横向相邻,纵向相邻,还有对角相邻),那么它们被认为是同一油藏的一部分.在这块矩形区域,可能有很多油藏.你的任务是确定有多少不同的油藏.输入输入可能有多个矩形区域(即可能有多组测试)。每个矩形区域的起始行包含m和n,表示行和列的数量,1=n||yy>=
qdu_lkc
·
2020-01-28 20:00
Java for
HDU1241
Oil Deposits
HDU1241OilDepositsProblemDescriptionTheGeoSurvCompgeologicsurveycompanyisresponsiblefordetectingundergroundoildeposits.GeoSurvCompworkswithonelargerectangularregionoflandatatime,andcreatesagridthatdiv
ecin520
·
2019-01-21 00:31
HDU1241
OilDeposits (DFS)c++
OilDepositsTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):46227AcceptedSubmission(s):26616ProblemDescriptionTheGeoSurvCompgeologicsurveycompanyisresponsiblef
DouglasConnor
·
2018-12-22 00:08
HDU
DFS
HDU1241
Oil Deposits(DFS)
题面:TheGeoSurvCompgeologicsurveycompanyisresponsiblefordetectingundergroundoildeposits.GeoSurvCompworkswithonelargerectangularregionoflandatatime,andcreatesagridthatdividesthelandintonumeroussquareplot
不卑鄙的异乡人
·
2018-07-29 12:27
训练
HDU1241
DFS/BFS 求连通块
0) 遍历所有点,求出连通块的数量,每到一块油田,就采用DFS或者BFS消除该油田以及附近连通的油田。 注意(易错): ①二维数组mat[i][j],i是第几行,j是第几列,所以搜到一点再搜该点周围八个方位(+dir[i][j])时,以及确定是否超出地图范围时,注意i是纵向加减,j是横向加减,且(0,0)原点在左上角,向右向下坐标的值都是不断递增。 ②sca
a272846945
·
2016-05-11 11:00
DFS
bfs
HDU 1241 Oil Deposits (搜索水题)
HDU1241
找连通集数量。注意第三个测试样例第一行后面多了一个空格,忽略即可。
Strokess
·
2016-03-11 18:00
HDU1241
Oil Deposits
原题地址:http://acm.hdu.edu.cn/showproblem.php?pid=1241题目大意:给一块油田,有油的是@,没油的是*,油田可以通过上下左右和对角线相连,问一共有几块连通的油田。由于数据很少(100*100)所以可深搜可广搜,以下是广搜的做法:从头开始遍历全图,每碰到一个没有标记过的油田就开始广搜,把搜过的都记上标记,然后油田总数加1。。#include #includ
qq_29480875
·
2016-01-31 14:00
hdu1241
深度搜索
OilDepositsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):20861 AcceptedSubmission(s):12005ProblemDescriptionTheGeoSurvCompgeologicsurveycompanyisresp
zcj5027
·
2016-01-27 17:00
hdu 1241 简单的搜索
题目简单,直接贴代码 /* *
hdu1241
/linux.cpp * Created on: 2011-9-4 * Author : ben */#include <cstdio>
·
2015-11-11 15:26
HDU
hdu1241
Oil Deposits
Oil Deposits  
·
2015-10-21 11:52
HDU
[leetcode] 200 Number of Islands(DFS)
类似的题目还有hdu1016,
hdu1241
。intdir[4][2]={{-1,0},{1,0},{0,1},{0,-1}}; classSolution{ public: voiddfs
NK_test
·
2015-10-12 23:00
LeetCode
C++
ACM
DFS
hdu1241
Oil Deposits
从今天巩固一下搜索方面的题,从简单的做起吧http://acm.hdu.edu.cn/showproblem.php?pid=1241ProblemDescription TheGeoSurvCompgeologicsurveycompanyisresponsiblefordetectingundergroundoildeposits.GeoSurvCompworkswithonelargerec
aonaigayiximasi
·
2015-09-15 20:00
HDU1241
Oil Deposits
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1241/*HDU1241OilDepositshttp://acm.hdu.edu.cn/showproblem.php?pid=1241二维并查集坐标转换(ij)->(i*列数+j)*/ #include #include #include #include #include #include usi
qq_26437925
·
2015-09-04 09:00
hdu1241
Oil Deposits裸的搜哦哦哦哦
rt题目#include #include usingnamespacestd; charch[105][105]; intn,m; intdir[8][2]={{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}}; voiddfs(intx,inty) { ch[x][y]='*'; for(inti=0;in)continue; if(n
zhou_yujia
·
2015-08-10 09:00
搜索
hdu1241
详解 Java广搜搞定
importjava.util.Scanner; publicclassMain{ publicstaticvoidmain(String[]args){ Scannersc=newScanner(System.in); while(sc.hasNext()){ intm=sc.nextInt();//输入地图的行数 intn=sc.nextInt();//输入地图的列数 if(m==0){/
u011459262
·
2015-08-03 21:00
java
广度搜索
hdu1241
hdu1241
(Oil Deposits)
点击打开hdu1241ProblemDescriptionTheGeoSurvCompgeologicsurveycompanyisresponsiblefordetectingundergroundoildeposits.GeoSurvCompworkswithonelargerectangularregionoflandatatime,andcreatesagridthatdividesthe
u011479875
·
2015-08-02 21:00
DFS深搜
hdu1241
【暑假集训专题#搜索
HDU1241
】
【题目链接】clickhere~~【题目大意】'@'代表油田位置,'*'代表地面,八个方向相邻的油田视为一个,求给定地图里油田数目【解题思路】八个方向搜索即可代码:#include #include #include #include usingnamespacestd; constintN=1010; intdir4[4][2]={{1,0},{0,1},{-1,0},{0,-1}}; intd
u013050857
·
2015-07-07 14:00
搜索
HDU1241
Oil Deposits DFS
OilDepositsTimeLimit:1000MS MemoryLimit:32768KB 64bitIOFormat:%I64d&%I64uSubmitStatusPracticeHDU1241DescriptionTheGeoSurvCompgeologicsurveycompanyisresponsiblefordetectingundergroundoildeposits.
wr132
·
2015-05-01 15:00
HDU
DFS
oil
Deposits
1241
poj 2386 dfs
id=2386几乎可以说跟
hdu1241
一模一样的题。再复习下dfs的写法就是要注意方向是八个方向都可以。
liujc_
·
2015-03-12 14:00
HDU1241
Oil Deposits DFS
题目大意:有一块油田,@表示改点为原油,*表示空地,每相邻的原油点(即上,下,左,右,斜边共8个方向相邻任意一方向相邻都可),他们的品种是一样的,现在问你该油田共有多少种不同的原油品种。分析:枚举每一个坐标点,如果该点为原油,计数器++,同时以该点为起点进行深搜,标记和该点相连的原油点为*。这样,枚举完每一个点之后,我们也就找到了不同的原油品种的数目了。裸DFS就行,下面是我的代码:#includ
AC_Gibson
·
2015-03-11 15:00
UVA572
HDU1241
POJ1562 Oil Deposits【DFS】
OilDeposits TheGeoSurvCompgeologicsurveycompanyisresponsiblefordetectingundergroundoildeposits.GeoSurvCompworkswithonelargerectangularregionoflandatatime,andcreatesagridthatdividesthelandintonumerous
u011676797
·
2014-12-11 17:00
hdu1241
oildeposits本题思路较为简单,依次查找,找到相关元素就压到队列里,利用队列完成其元素周围的所有元素的全部遍历,并进行标记,逐次遍历完。注意存储时的技巧,这样在操作时可以减少好多冗杂的操作。还有在for循环中的控制变量,如果是全局变量的话,一定慎重操作,或者直接写里边,在用到的时候再调出来,这样可以避免不必要的错误。#include #include #include usingnames
YeKYLI
·
2014-07-18 00:00
hdu
(图的遍历专题整理)
一、DFS在图的遍历中的使用1、
HDU1241
OilDeposits题目分析:这道题是一道简单的DFS的题目(当然也可以用其他方法来做).题目主要意思是求有多少块油田。
caihongshijie6
·
2014-06-05 22:00
HDU1241
#include#include#include#definemaxn200usingnamespacestd;charmap[maxn][maxn];boolvis[maxn][maxn];intn,m;voiddfs(intx,inty){ if(vis[x][y]||map[x][y]=='*') return; vis[x][y]=true; dfs(x-1,y-1); d
u013570474
·
2014-04-25 00:00
HDU1241
油田合并(DFS)
点击打开链接OilDepositsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):9572 AcceptedSubmission(s):5613ProblemDescriptionTheGeoSurvCompgeologicsurveycompanyis
u013790563
·
2014-02-28 14:00
ACM-DFS之Oil Deposits——
hdu1241
OilDepositsProblemDescriptionTheGeoSurvCompgeologicsurveycompanyisresponsiblefordetectingundergroundoildeposits.GeoSurvCompworkswithonelargerectangularregionoflandatatime,andcreatesagridthatdividesthe
lx417147512
·
2014-02-25 12:00
ACM
DFS
oil
Deposits
hdu1241
CSUST2013:专题训练[下半学年]
KnightMovesProblemB HDU1728 逃离迷宫ProblemC HDU2717 CatchThatCowProblemD HDU1312 RedandBlackProblemE
HDU1241
l383137093
·
2013-07-26 15:00
CSUST
HDU1241
Oil Deposits
OilDepositsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):7709 AcceptedSubmission(s):451
lsh670660992
·
2013-07-18 10:00
空格样例
HDU1241
:Oil Deposits
每日一贴,今天的内容关键字为空格样例 ProblemDescription TheGeoSurvCompgeologicsurveycompanyisresponsiblefordetectingundergroundoildeposits.GeoSurvCompworkswithonelargerectangularregionoflandatatime,andcreatesagri
·
2013-05-26 23:00
HDU
HDU1241
:Oil Deposits(DFS)
ProblemDescriptionTheGeoSurvCompgeologicsurveycompanyisresponsiblefordetectingundergroundoildeposits.GeoSurvCompworkswithonelargerectangularregionoflandatatime,andcreatesagridthatdividesthelandintonum
libin56842
·
2013-05-25 22:00
ACM
HDU
DFS
解题报告
搜索
HDU1241
:OilDepositsHDU1312:RedandBlackHDU1372:KnightMo
l383137093
·
2013-05-18 19:00
搜索
HDU1241
:Oil Deposits
点击打开题目链接OilDepositsTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):7150 AcceptedSubmission(s):4152ProblemDescriptionTheGeoSurvCompgeologicsurveycompany
l383137093
·
2013-04-21 17:00
数据结构
搜索
并查集
hdu1241
Oil Deposits
广搜题,题意为找到图中油田有多少块(相邻油田算入一块)。。。多次广搜,如果碰到'@'则置当前'@'为'*'同时counter++,然后从此点开始一次广搜,期间遇到'@'则立刻置为'*',重复进行直到图中所有点全部遍历完毕。。。。整体算法不难。。。写此解题报告纪念一下没有情人的情人节。。。^_^
zhang360896270
·
2011-02-14 17:00
hdu1241
hdu1241
好久没写搜索题了,把以前的题写过的重新写了下http://acm.hdu.edu.cn/showproblem.php?
xiaoguozi's Blog
·
2008-07-21 11: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
其他