编程介的小学生 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 C++实现删除N个数据列表共有的元素
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码