Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Salma lives at points (a, b) of the coordinate plane. She needs more time to go to her work. The yellow taxi has an application

Salma lives at points (a, b) of the coordinate plane. She needs more time to go to her work. The yellow taxi has an application that suggests n available cars nearby. The i-th taxi is located at point (xi, yi) and moves with speed vi.

Suppose that each n driver will move directly to Salam at the maximum possible speed. Compute the minimum time when Salam will get in any of the Yellow Taxi cars.

image

Input Format

The first line of the input contains two integers a and b ( - 100 a, b 100) coordinates of Salam's home.

The second line contains a single integer n (1 n 1000) the number of available yellow Taxi cars nearby.

The i-th of the following n lines contains three integers xi, yi, and vi ( - 100 xi, yi 100, 1 vi 100) the coordinates of the i-th car and its speed.

It's allowed that several cars are located at the same point. Also, cars may be found at exactly the same point where Salam lives.

Constraints

#

Output Format

Print a single real value the minimum time Salam needs to get in any of the Yellow Taxi cars. Your answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

Sample Input 0

0 0 2 2 0 1 0 2 2 Sample Output 0

1.00000000000000000000 Sample Input 1

1 3 3 3 3 2 -2 3 6 -2 7 10 Sample Output 1

0.50000000000000000000

Simple java solution.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions