[kuangbin带你飞]专题一 简单搜索 C - Catch That Cow poj 3278
来源:互联网 发布:mac的dock怎么隐藏 编辑:程序博客网 时间:2024/05/22 09:48
Description
Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately.
He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K
(0 ≤ K ≤ 100,000) on the same number line. Farmer John has two modes of transportation:
walking and teleporting.
* Walking: FJ can move from any point X to the points X - 1 or X + 1 in a single minute
* Teleporting: FJ can move from any point X to the point 2 × X in a single minute.
If the cow, unaware of its pursuit, does not move at all, how long does it take for Farmer
John to retrieve it?
Input
Output
Sample Input
5 17
Sample Output
4
Hint
题意:给你N和K 求N -> K 要几分钟
有以下变化
N -> 2*N 1分钟
N -> N+1 1分钟
N ->N-1 1分钟
用BFS 当 N>=K 输出N-K
N<K 用BFS搜
- [kuangbin带你飞]专题一 简单搜索C - Catch That Cow(POJ 3278)
- [kuangbin带你飞]专题一 简单搜索 C - Catch That Cow poj 3278
- POJ 3278 Catch That Cow(kuangbin带你飞 专题一:简单搜索)
- poj 3728 Catch That Cow ([kuangbin带你飞]专题一 简单搜索)
- [kuangbin带你飞]专题一 简单搜索 -C - Catch That Cow
- [kuangbin带你飞]专题一 简单搜索 Catch That Cow : bfs
- 3278 & [kuangbin带你飞]专题一 简单搜索 C
- [kuangbin带你飞]专题一 简单搜索 C POJ3278
- [kuangbin带你飞]专题一 简单搜索 C
- [kuangbin带你飞]专题一 简单搜索-C
- [kuangbin带你飞]专题一 简单搜索 C
- [kuangbin神带你飞]专题一 简单搜索
- kuangbin带你飞 专题一 简单搜索 (题解)
- Fire Game [kuangbin带你飞]专题一 简单搜索
- [kuangbin带你飞]专题一 简单搜索 总结
- Kuangbin带你飞专题一 简单搜索
- [kuangbin带你飞]专题一 简单搜索 D - Fliptile
- [kuangbin带你飞]专题一 简单搜索-J - Fire!
- ContentProvider两个应用之间访问数据
- JS中的this
- java应用一般架构
- PostgreSQL学习手册(常用数据类型)
- 606第九周周六赛 A - 免费馅饼
- [kuangbin带你飞]专题一 简单搜索 C - Catch That Cow poj 3278
- tomcat下jndi的三种配置方式
- 使用JDK编写webService
- HDU 4911 归并排序题目解析
- 2015.11.12 为什么还可以接着输入
- 时隔一年我又回来写博客。
- PostgreSQL学习手册(函数和操作符<一>)
- OpenSessionInViewFilter不起作用问题
- RecyclerView的局部刷新