编程介的小学生 2017-11-20 17:04 采纳率: 20.5%
浏览 582
已采纳

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 2018-09-01 15:23
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 Web.config连不上数据库
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?
  • ¥50 invest生境质量模块
  • ¥15 nhanes加权logistic回归,svyglm函数