编程介的小学生 2017-08-27 12:24 采纳率: 20.5%
浏览 692
已采纳

Enchantress

Problem Description
This time Vance controls a hero, enchantress and let's just called her Aiushtha. Aiushtha uses spear to attack and she has a powerful ultra skill called Impetus.
It will give your enemy huge damage every time you attack.
The damage equals to p*dis, p is constant decimal, and dis means the distance between you and your enemy when the spear hit your enemy.

Now Vance's enchantress is run after her enemy, to make the problem simple,
let's imagine that you and your enemy can only run left or right.
Your enemy will always run left and Aiushtha can turn around at any time.
Aiushtha can't go to the leftside of your enemy.

The firing range of enchantress is d, a.k.a. you cannot attack if the distance between you and your enemy if longer than d.
She can't attack twice within cd seconds. Your enemy speed is v1, your speed is v2, and your spear's speed is v3.
We guarantee that v3 > max(v1,v2). The enemy's current life point is hp.
When enchantress uses impetus to hurt his enemy, the enemy's life reduce the value of the damage that impetus makes.
In time t=0s your enemy is at x=0 and you are in x=d,
your enemy will always run leftwards now Aiushtha finds that she has only two spears and she want to kill his enemy as soon as possible. Can you help her?

Input
The first line contains a single positive integer T( T <= 200 ), indicates the number of test cases.
For each test case: give you the parameters separated by a single space in the following order: d, cd, v1, v2, v3, hp, p.
All of above numbers are positive decimals between 0 and 10^6 and we guarantee that cd is longer than the time the spear need to hit the enemy.
When the enemy's current hp is equals or lower than zero he died immediately. All of the given numbers have at most two decimals.

Output
For each test case: output the case number as shown and then output the least time needed to make the enemy die up to 4 decimals.
If it's impossible to kill the enemy output -1.

Sample Input
2
600 2 400 300 1000 2000 0.5
600 2 400 300 1000 200 0.5

Sample Output
Case #1: -1
Case #2: 1.0000

  • 写回答

1条回答

  • threenewbee 2017-09-10 15:53
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件