joj2476
来源:互联网 发布:仓库入库软件 编辑:程序博客网 时间:2024/06/14 00:39
[JPoints: 905, Sender!: 0/1]
2476: Star travel
In the future world, one can travel by spaceship from one star to another. Because of the long distance, the fuel consumption is not linear with distance. We should take more material within our spaceship, so the weight of total spaceship increased also. The fuel consumption F can be calculated by this formula.
F= a * d + b * d * d
Here, d is the distance between any two star, a and b are parameters.
Given the coordinates of each star, you should calculate the shortest path between two star. Here, shortest means the least fuel is used.
Input
The first line of each case is the number of stars n (2<=n<=20), and the double parameters a and b. The next n lines includes three double values that are x-axis, y-axis and z-axis coordinates. The next line is one integer m. There are two integers s and t in the next m lines, s and t is star number (from 1).
Output
For each question of each case, find out the shorest path between star s and t. Print the least fuel amount from star s to star t, rounded to 3 digit after the decimal point.
Sample Input
3 1.0 2.0-12.008 82.268 174.26050.033 1.675 108.423211.106 241.439 41.52823 22 1
Sample Output
176108.94629478.812
Problem Source: skywind
This problem is used for contest: 101
Submit / Problem List / Status / Discuss
- joj2476
- 2011:乱拳频出的中国互联网开放元年
- mysql 导入 导出 数据
- 诊断 CPU、内存或磁盘瓶颈的流程图(zt)
- android-java.lang.OutOfMemoryError: bitmap size exceeds VM budge
- CommonNavigator
- joj2476
- 外媒质疑Groupon中国战略:错误选择伙伴腾讯
- android-Bitmap, Drawable, Byte之间的转化
- 《算法导论》学习笔记-图的基本算法
- USB设备描述符
- 2011:中国互联网的“群架时代”开始!
- 开源GIS汇总
- ios 在下载html代码的时候,如何显示下载的进度
- 防范Sql注入式攻击