1031 : 弹跳机器人
时间限制Time Limit
1
秒Sec
内存限制Memory Limit
128
兆MB
提交次数Submitted
48 次Times
通过次数Solved
8 次Times
标准评测 Standard
从标准输入读入,结果写到标准输出。评测将输出拆成 token,与标准答案逐项比较,不按整段逐字节比对。
Read from standard input and write to standard output. The judge splits the output into tokens and compares them with the official answer; it does not compare raw bytes.
| 比对Compare | token 相同即通过。中间的空格、制表符、换行可多可少。Matching tokens pass. Extra spaces, tabs, or newlines between them are ignored. |
|---|---|
| 不同则错Differs | token 个数或内容不同即错误。23 与 2 3、02 与 2、2.0 与 2 均视为不同。A different token count or value is wrong. 23 vs 2 3, 02 vs 2, and 2.0 vs 2 all differ. |
| 输入Input | 标准输入,格式见题面。Standard input; format as in the statement. |
| 输出Output | 标准输出。Standard output. |
题目描述Description
一个平地上的机器人,只能往左往右移动,但是它有特殊的机械设施可以弹跳。
每秒钟 ,它可以做两种操作的其中一种:
- 调整一次角度,把当前角度调整为180度、150度、120度、60度、30度、0度 的其中一个;
- 基于当前角度跳跃
- 180度 | 0度:沿坐标轴平移
-1|1的距离; - 150度 | 30度:沿坐标轴平移当前
x坐标1/2|2倍的距离,除法向下取整; - 120度 | 60度:沿坐标轴平移当前
x坐标1/3|3倍的距离,除法向下取整。
- 180度 | 0度:沿坐标轴平移
例如,机器人在x坐标10的位置,基于以下角度移动结果:
- 180度:
9 - 0度:
11 - 150度:
5 - 30度:
20 - 120度:
3 - 60度:
30
机器人被限制在x坐标 [0, 10^5] 范围移动,给定起点与终点坐标,起始角度为 0度,每次移动之后保持上一次的角度。
求机器人至少需要几秒完成起点到终点的移动,对到达终点时的角度不做要求。
输入格式Input
多组测试数据,每组数据一行两个整数 s、e,表示机器人的起点与终点坐标。
0 <= s, e <= 10^5
输出格式Output
机器人从起点到终点所需最少秒数。
样例Sample
出题Author
CSGrandeur