编程介的小学生 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
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!