You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
382 B
C++

#include <cstdio>
#include <cmath>
int main()
{
int n, x0, y0, x, y, v;
double ans = 1e16, tmp;
scanf("%d%d%d", &x0, &y0, &n);
for (int i = 0; i < n; i++)
{
scanf("%d%d%d", &x, &y, &v);
x -= x0;
y -= y0;
tmp = sqrt(x*x + y*y) / v;
if (tmp < ans) ans = tmp;
}
printf("%.10lf", ans);
return 0;
}