A. Beru-taxi
time limit per test
memory limit per test
input
output
(a, b) of the coordinate plane. He is hurrying up to work so he wants to get out of his house as soon as possible. New app suggested n available Beru-taxi nearby. The i-th taxi is located at point (xi, yi) and moves with a speed vi.
n
Input
a and b ( - 100 ≤ a, b ≤ 100) — coordinates of Vasiliy's home.
n (1 ≤ n ≤ 1000) — the number of available Beru-taxi cars nearby.
i-th of the following n lines contains three integers xi, yi and vi ( - 100 ≤ xi, yi, 1 ≤ vi) — 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 located at exactly the same point where Vasiliy lives.
Output
10 - 6.
a, and the answer of the jury is b. The checker program will consider your answer correct, if
.
Examples
input
0 02 2 0 1 0 2 2
output
1.00000000000000000000
input
1 33 3 3 2 -2 3 6 -2 7 10
output
0.50000000000000000000
Note
2, and second will do this in time 1, therefore 1
2 and 3
暴力
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
typedef long long ll;
int main()
{
double a,b;
int n;
double x,y,v;
cin>>a>>b;
cin>>n;
cin>>x>>y>>v;
double w=(a-x)*(a-x)+(b-y)*(b-y);
double mi=sqrt(w)/v;
for(int i=1; i<n; i++)
{
cin>>x>>y>>v;
w=(a-x)*(a-x)+(b-y)*(b-y);
mi=min(mi,sqrt(w)/v);
}
printf("%.20f\n",mi);
return 0;
}