编程介的小学生 2017-08-05 08:33 采纳率: 20.5%
浏览 782
已采纳

Iraq War

In the Iraq war, one type of jeep called Hanma is used frequently by American. Now, you are a soldier of U.S army, and your commander asks you to send an important message to a base D in the center of desert from base S,which is your position now using your Hanma jeep.

Your jeep can load at most C kg diesel oil, and consumes U kg diesel oil per km. Among the desert, there are N service stations, but they are destroyed in the war. So you can't get anything in the station, but you can deposit your oil for future use or retake it. You can get diesel oil only in base S. As we know, U.S attacks Iraq for oil, so you should get as little oil as possible from station S. Now your first task is to make sure whether this mission is possible,which means if you can drive from base S to base D, if yes calculate how much oil is needed at least.

Input

There are many test cases. For each test case, the first line contains two real number C and U. The second line contain three integer N(<=100), S(0<=S<N), D(0<=D<N) which denotes thetotle number of service stations and bases, the next Sth line is the coordinate of base s and the next Dth line is the the coordinate of base D.
Then N line follow. Each line contains two real number x, y which is the coordinate of base or service station and denotes that the base or service station is x km to the original point in horizontal and y km to the the original point in vertical.
C==0 and U==0 denotes the end of input.

Output

For each testcase, if the mission is impossible, output "unreachable", else output the minimal amount of oil you need, accurate to 4 decimal num.

Sample Input

5.66 1
8 3 0
0 0
0 4
4 0
4 4
1 2
2 1
3 2
2 3

1 1
8 3 0
0 0
0 4
4 0
4 4
1 2
2 1
3 2
2 3

0 0

Sample Output

5.6569
unreachable

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-08-19 01:30
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器