CF706A Beru-taxi

水题,众所周知,两点之间直线距离:

(x2x1)2+(y2y1)2\Large \sqrt{(x2 - x1)^2+(y2-y1)^2}

然后就能过了:

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
using namespace std;

int main()
{
	double a, b, n, ans = 1e14;
	cin >> a >> b >> n;
	for (int i = 1; i <= n; i++)
	{
		double x, y, v;
		cin >> x >> y >> v;
		ans = min(ans, sqrt(pow(x - a, 2) + pow(y - b, 2)) / v);
	}
	cout << fixed << setprecision(20) << ans << endl;
	return 0;
}
posted @ 2022-01-05 21:28  HappyBobb  阅读(7)  评论(0)    收藏  举报  来源