Catch That Cow
来源:互联网 发布:mac播放器哪个好 编辑:程序博客网 时间:2024/06/14 10:51
Description
Farmer John has been informed of the location of a fugitive cow andwants 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 oftransportation: 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 longdoes it take for Farmer John to retrieve it?
Input
* Line 1: Two space-separated integers: N and K
Output
* Line 1: The least amount of time, in minutes, it takes for Farmer John to catch the fugitive cow.
Sample Input
5 17
Sample Output
4
0 0
- POJ3278 Catch That Cow
- Catch That Cow
- Catch That Cow
- poj3278 Catch That Cow
- 3278. Catch That Cow
- 【HDU2717】-Catch that cow
- Catch That Cow
- F - Catch That Cow
- poj3278 - Catch That Cow
- HDOJ Catch That Cow
- 2717Catch That Cow
- POJ3278 Catch That Cow
- 3278Catch That Cow
- Catch That Cow(bfs)
- Catch that cow (H2717)
- POJ3278--Catch That Cow
- Catch That Cow
- Catch That Cow+BFS
- VisualSVN Server安装时无法启动服务的解决
- 数据结构之双线链表
- highcharts useUTC:针对xAxis的type为datetime类型
- 基础教程2——Start Developing iOS Apps Today——从今天开始开发IOS(IOS7版)系列源文档翻译(三)
- Python 注意
- Catch That Cow
- apache之mina
- javah命令提示无法访问android.app.activity类文件
- 新中国建国后的战略漫谈(转载)
- DTrace C++ Mysteries Solved
- x64中oralce建库弹出警告“Enterprise Manager配置失败...”引起的google
- shellExcute执行带图片路径的exe程序
- OpenGL Pipeline
- 如何获取精确到毫秒的当前时间以及 日期与时间的相互转化