码迷,mamicode.com
首页 >  
搜索关键字:bfs dfs    ( 14889个结果
Zoj 2913 Bus Pass BFS
题意: 给你一张图,和一些指定的点,找一个点使得这些指定的点到这个点的距离的最大值最小对每一个指定的点都做一遍BFS,更新到达每个点的距离,取较大值,然后扫一遍所有的点,找出最小即可。注意:不同于走格子,因为方向比较多,所以要在扩展节点的时候就更新vis数组,不然有可能导致某个点的距离因为重复更新而...
分类:其他好文   时间:2014-07-12 08:48:10    阅读次数:227
SGU 224.Little Queens
时间限制:0.75s空间限制:6M题意 n*n(n>1; r同理,即rint n, sum, max, k, m;void dfs (int line , int row, int l, int r, int k) { int pos, p, i; if (line > n){ ...
分类:其他好文   时间:2014-07-11 17:59:56    阅读次数:358
poj1753 Flip Game(枚举Enum+dfs)
poj1753 Flip Game(枚举Enum+dfs)...
分类:其他好文   时间:2014-07-11 00:57:41    阅读次数:251
Cannot lock storage /tmp/hadoop-root/dfs/name. The directory is already locked.
ERROR namenode.NameNode: java.io.IOException: Cannot lock storage /tmp/hadoop-root/dfs/name. The directory is already locked....
分类:其他好文   时间:2014-07-11 00:23:43    阅读次数:362
HDU 1241 :Oil Deposits
Oil Deposits Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 11360    Accepted Submission(s): 6626 Problem Description The GeoSurvComp ...
分类:其他好文   时间:2014-07-10 23:11:40    阅读次数:239
poj2965 The Pilots Brothers' refrigerator(直接计算或枚举Enum+dfs)
POJ2965 The Pilots Brothers' refrigerator(直接计算或枚举Enum+dfs)...
分类:其他好文   时间:2014-07-10 21:18:20    阅读次数:188
poj1985 Cow Marathon --- 树的直径
树的直径即树中最长的路径的长度。 用两次dfs,第一次从任意点出发求得一个最远点p, 第二次从p出发求得最远点,这条路径就是最长路,即所求。 #include #include #include #include #include #include #include #include #include #define inf 0x3f3f3f3f #define...
分类:其他好文   时间:2014-07-10 19:46:15    阅读次数:197
[Codeforces 258B & 259 D]Little Elephant and Elections 数位dp+dfs
题目大意: 说七个party选择数字(各不相同) 而规定的小象的party选择的数字之中所拥有的数字4和7的个数要比其他六个party拥有的个数之和还要严格多,询问方案数。 如m=7时其余的随意选择至少会拥有一个4或7,与题意矛盾,故方案数为0 m=8时,7 1 2 3 5 6 8是一种合法方案 思路: 由于小象的party选到的数字所含4和7的个数至多和m的位数一样多,则枚举小象的party所含4和7的个数,剩余的6个party直接用dfs即可(直接用乘法原理)。 而通过数位dp可以算出1~m之中所拥有...
分类:其他好文   时间:2014-07-10 19:44:26    阅读次数:193
POJ-3134-Power Calculus(迭代加深DFS)
Description Starting with x and repeatedly multiplying by x, we can compute x31 with thirty multiplications: x2 = x × x, x3 = x2 × x, x4 = x3 × x, …, x31 = x30 × x. The operation of squarin...
分类:其他好文   时间:2014-07-10 17:36:07    阅读次数:202
POJ 3278: Catch That Cow
Catch That Cow Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 44613   Accepted: 13946 Description Farmer John has been informed of the location of a fugit...
分类:其他好文   时间:2014-07-10 17:30:26    阅读次数:145
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!