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
3278
POJ
3278
Catch That Cow【BFS】
题意:给出n,k,其中n可以加1,可以减1,可以乘以2,问至少通过多少次变化使其变成k 可以先画出样例的部分状态空间树 可以知道搜索到的深度即为所需要的最小的变化次数 下面是学习的代码----@_@ #include<iostream> #include<cstdio> #include<cstring> #include
·
2015-11-10 23:26
catch
POJ
3278
Catch That Cow
解题思路:BFS 代码 #include < iostream > #include < cmath > using namespace std; #define MAXN 100001 in
·
2015-11-10 21:14
catch
ZOJ 3188 Treeland Exhibition(树形DP)
problemId=
3278
题意:给出一棵树,找出一个不大于长度为m的链,使得其他点到该链的长度之和最小。 思路:首先,链有两种。
·
2015-11-09 14:43
tree
poj
3278
bfs
题目大意:FJ要去抓牛... 思路:bfs即可 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 using namespace std; 5 6 const int N = 100001; 7 bool visit[N]; 8 9 str
·
2015-11-09 13:33
poj
POJ
3278
Catch That Cow(BFS)
DescriptionFarmerJohnhasbeeninformedofthelocationofafugitivecowandwantstocatchherimmediately.HestartsatapointN(0≤N≤100,000)onanumberlineandthecowisatapointK(0≤K≤100,000)onthesamenumberline.FarmerJohnh
JoneZP
·
2015-11-09 09:00
POJ
3278
Catch That Cow 解题报告
分类:DFS,STL, 作者:ACShiryu 时间:2011-7-23 地址: http://www.cnblogs.com/ACShiryu/archive/2011/07/23/2114978.html Catch That Cow Time Limit: 2000MS Memory Limit: 65536K Total Subm
·
2015-11-08 16:46
catch
Poj
3278
Catch That Cow
id=
3278
2.Content: Catch That Cow Time Limit: 2000MS Memory Limit: 65536K
·
2015-11-08 13:41
catch
poj
3278
Catch That Cow
简单深搜。 CODE: #include <iostream> #include < string.h> using namespace std; const int large= 200030; typedef class { &nbs
·
2015-11-08 11:36
catch
poj
3278
_bfs
题意:X坐标轴上有A,B两点,两点的坐标都介于0与100000之间(包括),A点可以有两种方式走动:1.从A走到A-1或者A+1,用时1分钟。2.从A到2*A,用时1分钟,求从A到B最短的时间。 分析:这个题用BFS,数组应该开多大呢?有的点乘以2后会比100000大。其实开100001就可以了。如果存在一个路径中有比100000还大的点,那一定存在一条所用时间还要小的所有的点都在100000一
·
2015-11-07 12:18
poj
UGUI
UGUI研究院之全面理解图集与使用[1]http://www.xuanyusong.com/archives/
3278
[2]http://www.xuanyusong.com/archives/3293
javalzy
·
2015-11-06 11:00
UGUI
UGUI研究院之全面理解图集与使用[1]http://www.xuanyusong.com/archives/
3278
[2]http://www.xuanyusong.com/archives/3293
javalzy
·
2015-11-06 11:00
POJ
3278
Catch That Cow(BFS基础)
题目大意: 给你两个数字,n和k,对于n有三种变化规则。 1.n->n-1; 2.n->n+1; 3.n->2*n; 使得n==k,问如何需要最少的操作次数。 解题思路: 凡是有关最少操作次数的问题,就归结为bfs来求解,这道题是一个三入口式的bfs。。。 在搜索的过程中,一定要注意是否有需要剪纸的必要,不然蛮力上的话,必然会导致RE。
·
2015-11-03 21:37
catch
Catch That Cow--POJ
3278
1、解题思路:经典广度搜索。 2、注意事项:设置标记数组避免重复访问。 3、实现方法: #include < iostream > #include < queue > using namespace std; struct Node{ int
·
2015-11-02 16:01
catch
几道搜索题目
hdu
3278
Puzzle 题目来源:http://acm.hdu.edu.cn/showproblem.php?
·
2015-11-02 15:36
搜索
pku
3278
Catch That Cow BFS
id=
3278
就是农场主在X轴上找牛,给定牛的坐标,扭不动,农场主可以 +1 -1 *2 的方式前进,求最少的步数使其找到牛。
·
2015-11-01 14:39
catch
pku
3278
id=
3278
可能写DFS写的比较习惯吧,每次只要遇到搜索提就会用DFS写。结果DFS版本各种剪枝后还是TLE郁闷。。求用dfs过的大牛代码。。
·
2015-11-01 14:02
pku
POJ
3278
Catch That Cow
Original ID:
3278
64-bit integer IO format: %lld Java cl
·
2015-11-01 11:36
catch
HDU
3278
Puzzle (蛋疼。。。。)
Puzzle Time Limit : 6000/3000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 15 Accepted Submission(s) : 8 Problem Description
·
2015-11-01 08:01
HDU
hdu
3278
Puzzle
其实最终的结果无非是中间8个方块是相同的颜色,外面16个方块是另外两种颜色。那么其实可以把外面两种颜色看作是0,中间的颜色看做是1。 那么题目就变成了把那种颜色看做1,而其它两种颜色看做0,可以用最少的步骤得到结果。 那么24个方块就可以用24位二进制来标记。那么判重的方式找到了,映射为一个int类型的整数hash 而方块的移动可以看做是位运算的组合,慢慢想想就能够用位运算直接在整数hash
·
2015-10-31 12:18
HDU
poj
3278
catch that cow
id=
3278
bfs,用到了stl的queue #include <algorithm> #include <cstdio> #include <
·
2015-10-31 11:16
catch
Problem C POJ
3278
Catch That Cow(三入口bfs)
C - Catch That Cow Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice&n
·
2015-10-31 11:50
catch
poj
3278
Catch That Cow (BFS)
题意: 牛逃跑了,主人用最短的时间追到牛(在直线上) 很裸的bfs ,郁闷啊忘了判断重复了,RE ,WA ! #include<stdio.h>#define N 100005int n,k;int stack[N],vis[N];int main(){ s
·
2015-10-31 11:36
catch
zoj
3278
8G Island
二分 比较好的二分题目,需要花点脑筋想到,另外写的细节也多 题意:比较好懂,a数组有n个元素,b数组有m个元素,a数组的元素分别和b数组的元素相乘得到新的元素,那么一共会得到n*m个元素,将这些元素降序排序,找到第k大的元素是谁 为检验算法正确性,一个暴力的程序很容易写出来,关键是正解是什么,ab数组的元素个数都很多,暴力会超时,而且空间也不允许 使用二分,而且是嵌套的二分,两个二分的目的
·
2015-10-31 11:19
ZOJ
poj
3278
Catch That Cow Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 22900 Accepted: 7027 Description Farmer John has been informed of the location of a fug
·
2015-10-31 10:13
poj
【原】 POJ
3278
Catch That Cow BFS单源无权图最短距离 解题报告
id=
3278
方法: 单源无权图最短距离,即BFS 该问题只需要求得某两点间的最短距离,所以不必求得所有节点的最短距离,一旦处理了目的地点,即可返回结果 Description
·
2015-10-31 10:33
catch
VS中C#读取app.config数据库配置字符串的三种方法
VS中C#读取app.config数据库配置字符串的三种方法(转) http://hi.baidu.com/mindox/item/
3278
dc352c7ba68fb80c0389 http://www.blogjava.net
·
2015-10-31 10:13
config
Catch That Cow(捉住那头牛)
poj
3278
题目大意:给出坐标中人的位置和牛的位置,然后牛不动,让你按照给定的策略(走一秒,退一退,走二倍当前的时间)去到牛的身边,求最小步子数 解决:DFS,分析若一开始牛在人的身后
·
2015-10-31 10:30
catch
Catch The Caw——(广度优先搜索的应用,队列)
抓住那头牛(POJ
3278
)农夫知道一头牛的位置,想要抓住它。农夫和牛都位于数轴上,农夫起始位于点N(0<=N<=100000),牛位于点K(0<=K<=100000)。
·
2015-10-31 09:33
catch
BNUOJ
3278
Candies
Candies Time Limit: 1500ms Memory Limit: 131072KB This problem will be judged on PKU. Original ID: 3159 64-bit integer IO format: %lld Java class na
·
2015-10-31 08:25
IE
POJ
3278
(bfs)
Catch That Cow Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 31637 Accepted: 9740 Description Farmer John has been informed of the location of a fugitive c
·
2015-10-30 15:28
poj
POJ-
3278
Catch That Cow bfs
跟杭电的奇怪的楼梯非常想。 代码如下: #include <cstdio> #include <queue> using namespace std; struct Node { int x, t; }e[100005], pos; int N, K, front, tail, hash[100005]; void getnewpo
·
2015-10-30 14:21
catch
如何使用ModelSim作前仿真与后仿真? (SOC) (Quartus II) (ModelSim)
(SOC) (Quartus II) (ModelSim) 来源:http://hi.baidu.com/davinzhan/blog/item/5ad9e21660aa4659f2de
3278
.html
·
2015-10-30 13:02
Model
CatchTheCaw ----广搜入门
抓住那头牛(POJ
3278
)农夫知道一头牛的位置,想要抓住它。农夫和牛都位于数轴上,农夫起始位于点N(0<=N<=100000),牛位于点K(0<=K<=100000)。
·
2015-10-30 13:48
catch
POJ
3278
Catch That Cow
#include<stdio.h> #include<iostream> #include<cstdio> #include<queue> #include<memory.h> #define maxn 100005 using namespace std; queue<int> q; int step[max
·
2015-10-30 13:33
catch
poj
3278
BFS,注意判断数组是否越界,注意处理n==k的情况 View Code #include < iostream > #include < cstdlib > #include < cstring > #include &
·
2015-10-30 12:58
poj
POJ
3278
Catch That Cow bfs 难度:1
id=
3278
从n出发,向两边转移,为了不使数字无限制扩大,限制在2*k以内, 注意不能限制在k以内,否则就缺少不断使用-1得到的一些结果 #include <cstdio> #
·
2015-10-27 14:43
catch
poj
3278
Catch That Cow
本来用DFS做的,总是超时,拿别人AC的程序一测数据结果还一样,但是就是超时,这道题用DFS做要有很多剪枝,不然会有很多的重复,比如第x步走过点m,回溯后再DFS第y步的时候又走过m点,会有大量重复情况,还是BFS比较好剪枝/* CatchThatCow TimeLimit:2000MSMemoryLimit:65536K TotalSubmissions:63279Accepted:19813
EventQueue
·
2015-10-25 19:00
算法
ACM
poj
bfs
POJ
3278
Catch That Cow
Catch That Cow Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 35043 Accepted: 10800 Description Farmer John has been informed of the loc
·
2015-10-23 08:14
catch
POJ-
3278
Catch That Cow:BFS
能想到用广搜来解这道题也够diao了:广搜到 目标节点 就可以得到答案 steps #include<iostream> #include<queue> #include<cstring> using namespace std; struct node { int Value, Steps; node( i
·
2015-10-23 08:32
catch
poj 搜索题目
简单搜索(1)深度优先搜索 (poj2488,poj3009,poj1321) (2)广度优先搜索 (poj
3278
,poj1426,poj3126,poj3087.poj3414,poj2251
·
2015-10-21 12:37
poj
HDU
3278
Puzzle
HDU_
3278
尽管如果考虑有三种颜色的话状态数会很多,但如果一旦确定我们要将哪个颜色移到中间,其余的两个颜色就可以视作一种颜色,因此就可以先从终态开始bfs一遍,记录下结果
·
2015-10-21 10:08
HDU
POJ
3278
Catch That Cow
POJ_
3278
这个是个比较简单的BFS的题目。
·
2015-10-21 10:22
catch
POJ
3278
http://poj.org/problem?id=
3278
id=
3278
题目大意: m,n两个数m可+1, -1, *2变成n,需要经过几步 #include<stdio.h> #include<stdlib.h> #
·
2015-10-21 10:35
http
POJ
3278
Catch That Cow(BFS)
点击打开链接DescriptionFarmerJohnhasbeeninformedofthelocationofafugitivecowandwantstocatchherimmediately.HestartsatapointN(0≤N≤100,000)onanumberlineandthecowisatapointK(0≤K≤100,000)onthesamenumberline.Farme
Mosu_
·
2015-10-15 19:00
POJ
3278
Catch That Cow
#include #include #include usingnamespacestd; intN,K;//农夫N,牛K constintMAXN=100000; intvisited[MAXN+10];//判重标记,visited[i]=1表示i已经扩展过 structStep{ intx;//位置 intsteps;//到达x所需的步数 Step(intxx,ints):x(xx),ste
lydyangliu
·
2015-10-13 09:00
poj
bfs
poj
3278
#include #include #include #include usingnamespacestd; intn,k; intstep[100010]; intvis[100010]; queueq; intbfs(intn){ q.push(n); step[n]=0; vis[n]=1; inthead,next; while(!q.empty()){ inti; head=q.fr
Strokess
·
2015-10-08 16:00
ACM/ICPC 之 BFS-广搜+队列入门-抓牛(POJ
3278
)
这一题是练习广度优先搜索很好的例题,在很多广搜教学中经常用到,放在这里供学习搜索算法的孩纸们看看==题目大意:一维数轴上,农夫在N点,牛在K点,假定牛不会移动,农夫要找到这头牛只能够进行以下三种移动方法2*N-跳跃到两倍于自己所在的位置N+1-右移一位N-1-左移一位BFS解法解析:按照移动步数依次遍历队首,pop掉,并拓展出下一步所有可走位置并依次压入队列(不懂的孩纸们找度娘,很基础的数据结构)
disuo8001
·
2015-09-29 12:00
数据结构与算法
poj
3278
Catch That Cow bfs
id=
3278
DescriptionFarmerJohnhasbeeninformedofthelocationofafugitivecowandwantstocatchherimmediately.HestartsatapointN
aonaigayiximasi
·
2015-09-17 20:00
poj
3278
Catch That Cow(经典bfs)
id=
3278
Language:DefaultCatchThatCowTimeLimit: 2000MS MemoryLimit: 65536KTotalSubmissions: 62063 Accepted
theArcticOcean
·
2015-08-30 20:00
poj
bfs
ZOJ
3278
8G Island (二分套二分)
俗话说二分很难,真的很难,,,很难。(我会说这道题解一晚上么)题目让求两数列乘积的n*m个数中第k大。思路就是在[min,max]的范围内二分答案,然后对于每个二分的中点mid,枚举a[i],二分求出对于每个a[i],有几个b[j]使得a[i]*b[j]>=mid。然后把统计的个数全都加起来就是mid在n*m个数中的排名。我们要找的就是最大的mid使得n*m个数中大于等于mid的数共有k个。#pr
acraz
·
2015-08-27 00:00
上一页
1
2
3
4
5
6
7
8
下一页
按字母分类:
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
其他