Question: Either Python or Java is OK! Thank you ! Achilles and the Tortoise are locked in a game of tag, with the Tortoise currently being

 Either Python or Java is OK! Thank you ! Achilles andthe Tortoise are locked in a game of tag, with the Tortoise

Either Python or Java is OK! Thank you !

Achilles and the Tortoise are locked in a game of tag, with the Tortoise currently being "it."This means he must catch Achilles. After playing his favorite computer game, Portal, the Tortoise designed himself a portal gun to assist him. Achilles is at location A on some long 1-dimensional road, the Tortoise at location T (and they cannot stray from the road). In one minute, starting from location L, the Tortoise can walk 1 unit forward or backward, or use its portal gun to travel to 2L: L{L+1, L- 1,2L You job is to find the minimum number of minutes it will take to Tortoise to reach Achilles, assuming Achilles does not move the entire time Input Format A single line containing the integers T and A. For example if the Tortoise starts at location 12 and Achilles at 200: 12 200 Constraints 0 A 100,000 0 T S 100,000 Output Format A single line solely with the the minimum number of minutes for the Tortoise to reach Achilles. For example if it takes the Tortoise a minimum of 5 minutes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!