BestCoder Round #61 (div.2) HDU5523 Game
来源:互联网 发布:linux 通配符 编辑:程序博客网 时间:2024/05/22 16:38
Game
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 164 Accepted Submission(s): 76
Problem Description
XY is playing a game:there are N pillar in a row,which numbered from 1 to n.Each pillar has a jewel.Now XY is standing on the S-th pillar and the exit is in the T-th pillar.XY can leave from the exit only after they get all the jewels.Each time XY can move to adjacent pillar,or he can jump to boundary ( the first pillar or the N-th pillar) by using his superpower.However,he needs to follow a rule:if he left the pillar,he no can not get here anymore.In order to save his power,XY wants to use the minimum number of superpower to pass the game.
Input
There are multiple test cases, no more than 1000 cases.
For each case,the line contains three integers:N,S and T.(1≤N≤10000,1≤S,T≤N)
For each case,the line contains three integers:N,S and T.
Output
The output of each case will be a single integer on a line: the minimum number of using superpower or output -1 if he can't leave.
Sample Input
4 1 44 1 3
Sample Output
01
Source
BestCoder Round #61 (div.2)
出题人:
无解的情况只有起点和终点位置一样且N不为1。
终点和起点都在边界上答案为0,
如果起点在边界上或者起点终点相邻答案为1,
其他答案为2.
0 0
- BestCoder Round #61 (div.2) HDU5523 Game
- BestCoder Round #61 (div.2)(hdu5522,hdu5523,hdu5524,hdu5525(数论:费马小定理))
- BestCoder Round #61 (div.2) Game
- hdu 5523 Game 【BestCoder Round #61 (div.2)】
- BestCoder Round #61 (div.2)
- BestCoder Round #61 (div.2)
- hdu5494 Card Game(BestCoder Round #58 (div.2))
- BestCoder Round #58 (div.2)Card Game(hdu5494)
- BestCoder Round #58 (div.2)HDU5494 Card Game
- BestCoder Round #61 (div.2) 1001
- BestCoder Round #61 (div.2) 1002
- BestCoder Round #61 (div.2) HDU5522 Numbers
- BestCoder Round #61 (div.2) Numbers
- hdu5523 Game
- BestCoder Round #11 (Div. 2)
- BestCoder Round #11 (Div. 2)
- BestCoder Round #50 (div.2)
- BestCoder Round #50 (div.2)
- Leap Motion 使用OpenCV获取和显示图像
- HDU5525(乘法原理)
- SDUT 2500 统计N!中包含末尾0 的个数
- HDU 5524 Subtrees
- python 文件读写查找、替换相关简单操作
- BestCoder Round #61 (div.2) HDU5523 Game
- git 服务器搭建 for linux
- HDU-5512 Pagodas(GCD)
- 数据结构实验一(1)
- Http Chunked Transfer Coding
- javaScript对象详解
- Java生产者消费者例子尝试
- HDU 5510 Bazinga(思维)
- 通过rsync+inotify实现服务器之间数据的实时备份