Author: Md Shahid
Tester: Arkapravo Ghosh
Editorialist: Md Shahid
Given h,d and u.
In this problem Jagga can only run away if he get a car. One of his friend is standing at the top of building of height ‘h’ having key of car which is near Jagga. Police is following Jagga and Jagga is running at the constant speed of ‘u’.His friend standing at the top of building throw that key of car if Jagga can catch the key then he can start the car at time and run away If he fails to do so he will be caught by police.Here you have to find time to reach Jagga at the position where the key have been thrown and the time to reach the key from top of the building to ground.
Time taken to reach Jagga at position where the key has been thrown = Tg
Time taken to reach the key from top of the building to ground = Tk
Formula used :
- S= V*t
- S = U*t + (1/2)g(t^2)
Where V= final velocity, U=initial velocity, X=distance covered in time ‘t’, g=acceleration due to gravity.
Here initial velocity U is zero. - Tg= (d/u) using formula 1. - d= 0 + (1/2)*g*(Tk^2) i.e., Tk= (2*d/g)^0.5
if Tk >= Tg, print “Run away”
else, print “Caught”
AUTHOR’S AND EDITORIALIST’S SOLUTIONS:
Author’s and editorialist’s solution can be found here.
Tags:- ENCODING CTKL dshahid380