7 kyu

Approaching enemies

278 of 725Fabianopb

Description:

You are in a military mission in the middle of the jungle where your enemies are really hard to spot because of their camouflage. Luckily you have a device that shows the position of your enemies!

Your device is a radar that computes the x and y coordinates of an enemy in meters every 5 seconds. You are always at the point (0, 0) and your enemies are always heading towards you.

Your task

The radar will give you two consecutive points P1(x, y) and P2(x, y) of an enemy and you should write a function that will return the estimated time in seconds that the enemy will take to reach you, so you can defend! Python results should be rounded to 3 decimal places.

Hints

Distance between two points. Remember that you are working with only 2 dimensions!

Tests will have a precision of 3 decimal points. Good luck!

Puzzles
Games

Stats:

CreatedMar 1, 2016
PublishedMar 2, 2016
Warriors Trained1567
Total Skips50
Total Code Submissions2041
Total Times Completed725
Java Completions297
Ruby Completions80
C# Completions113
Python Completions278
Total Stars22
% of votes with a positive feedback rating92% of 188
Total "Very Satisfied" Votes162
Total "Somewhat Satisfied" Votes23
Total "Not Satisfied" Votes3
Total Rank Assessments15
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Fabianopb Avatar
  • DanWaxman Avatar
  • mwalski Avatar
  • ParanoidUser Avatar
  • Iron Fingers Avatar
  • hobovsky Avatar
  • cliffstamp Avatar
  • Haksell Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad