All submissions for this problem are available.
A building is shaped like a cone. In order to reach the top, 'Speed Racer' has to ride his moto-cross bike around the entire floor (i.e. around a ring) and then take a lift to the next level. At the centre of the building is another lift that goes directly from the bottom to the top of the building. The height of the building is equal to the radius of the bottom floor.
'Speed Racer' has to race against his rival 'Boogeyman' who is taking the direct lift to the top i.e. the central lift, but, for every 2 floors that 'Boogeyman' travels up, he has to travel 1 floor down. When 'Boogeyman' goes downwards by one floor, if he lands on an even numbered floor then 'Speed Racer' can activate his nitrous oxide boost and move twice as fast on whichever floor he is on. Else, if 'Boogeyman' lands on an odd numbered floor whenever he moves downwards, 'Speed Racer' can skip whichever floor he is on, but when he takes the lift to the next floor, the speed of the lift is equal to 50% of the speed of the central lift.
Once 'Speed Racer' travels around the entire circumference of each floor and progresses to the
next, the radius decreases by N, where N is the number of floors in the building.
THIS IS A TURN BASED MATCH.
i.e. one of the two competitors gets to go first (based on user entry). If 'Boogeyman' goes first, he has to wait for 'Speed Racer' to finish his journey before moving upwards again, once he has reached an even/odd floor on his journey down. Else, if 'Speed Racer' goes first, he has to wait on his floor till the time 'Boogeyman' has reached an odd/even floor on his journey downwards.
The First line contains the number of test cases, T.
T test cases follow.
For each test case,
The first line contains two space separated values, S and C.
The second line contains two space separated values, H and N.
The third line contains an integer F denoting who takes the first turn.
The symbols :
S denotes Speed Racer's speed in "km/hr".
C denotes the speed of the central lift in "km/hr".
H denotes the height of the building IN METRES.
N denotes the number of floors in the building.
F denotes who goes first :
F = 1 implies Boogeyman takes the first turn.
F = 2 implies Speed Racer takes the first turn.
Assume that the time 'Speed Racer' takes to move between floors is zero (except the case when Boogeyman lands on an odd numbered floor) and that his speed is constant on every floor. Also, the time taken by Boogeyman to move down one floor is half the time taken by him to move up one floor.
The first line should contain Speed Racer's time to the top in seconds.
The second line should contain Boogeyman's time to the top in seconds.
The third line should contain the string "Speed Racer FTW" if 'Speed Racer' defeats his rival, OR "Boogeyman shames Speed Racer" if 'Speed Racer' loses.
H = N^2(where H = height of building and N = number of floors).
Use Google for converting between units if in doubt.
Input: 1 72 7.2 16 4 2 Output: 14.000000 20.000000 Speed Racer FTW
|Time Limit:||0.1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, GO, PYP3|
Fetching successful submissions
If you are still having problems, see a sample solution here.