CDC12_D - Drastic Race

no tags 

Rainbowland and planet Earth made a giant and a fancy collision! Now Ronny ran out of the CEIDEC worried and running to search his family, however, when he was running to his car, a Rainbowlandian explode the car, teddy bears flew out of it and Ronny was the first to discover officially that we’re not alone on this universe.

Angry about his car explosion, Ronny shouted to the Rainbowlandian all sort of swearings, then, in the blink of an eye, several Rainbowlandians appeared with some strange vehicles describing circles around Ronny and challenging him to do a race to some point of the empty highway. What the Rainbowlandians don’t know is that Ronny got some special compound that gives him super reflexes and he can, with that, overtake the Rainbowlandians by increasing his speed to the limit. However, this compound is very limited so Ronny must to use it wisely. He wants to reach his destination as soon as possible and faster than any other Rainbowlandian chasing him, otherwise, the Rainbowlandian will blow him up as they did with the car.

Can you help him to determine whether he can win the race?

You should take the following aspects into account:

  • Ronny can use the compound if and only if he is able to.
  • Ronny can restore the compound if and only if he stays still without moving.
  • Ronny can only win if his time is less than the fastest Rainbowland, so, in case of tie, Ronny lose.

Input

The first line contains an integer T, which specifies the number of test cases. Then, will follow the descriptions of T test cases.

Each case will have 6 integers P, M, V, S, K, D, which denote, respectively, the time that will take to the fastest Rainbowlandian to get to the finish line, the meters up to the finish line, the normal velocity of Ronny, the boost that Ronny acquires when using the compound, the time that he can use the ability and the amount of compound he restores by second. (Have in account that he will not restore the compound more than what is given at the beginning.)

Output

For each case you must print the string "Scenario #i: " where i is the test case you’re analyzing (starting at 1) followed by the string "Ronny wins in time R" if and only if Ronny is able to win the race, R is the units of time that Ronny takes to win the race, otherwise print "Ronny will be annihilated". (Quotes for clarity.)

Sample

Input
2
10 500 40 40 5 1
7 1000 40 40 5 1

Output
Scenario #1: Ronny wins in time 8
Scenario #2: Ronny will be annihilated

Constraints

  • 1 ≤ T ≤ 20
  • 1 ≤ P ≤ 10,000
  • 1 ≤ M ≤ 10,000
  • 1 ≤ V ≤ M
  • 1 ≤ S ≤ M
  • 1 ≤ K ≤ 100
  • 1 ≤ D ≤ K

hide comments
Gregorius Edward: 2012-12-02 11:23:24

If there are more than 1 answer which one should i choose?
Thank you.

Last edit: 2012-12-02 11:28:03
Rocker3011: 2012-12-01 19:59:07

hello, just want to add something, please change this line in problem statement: "the time he can use the ability" should be: "the number of times he can use the ability" this can lead to some confusion about the problems explanation :)

BTW awesome problem

Last edit: 2012-12-01 06:01:48
Suraj D: 2012-12-01 19:59:07

@Problem Setter: What is the initial amount of compound ? Is it equal to the time for which we can use the compound?

Problem setter: <b> Yes, K at beginning. </b>

Last edit: 2012-12-01 09:37:37

Added by:Venezuelan Programming League
Date:2012-10-27
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:Own problem used for UCV-CEIDEC contest.