CodeForces 706A Beru

编程入门 行业动态 更新时间:2024-10-07 20:34:43

<a href=https://www.elefans.com/category/jswz/34/1770097.html style=CodeForces 706A Beru"/>

CodeForces 706A Beru

Description

Vasiliy lives at point (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.

Consider that each of n drivers will move directly to Vasiliy and with a maximum possible speed. Compute the minimum time when Vasiliy will get in any of Beru-taxi cars.

Input

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

The second line contains a single integer n (1 ≤ n ≤ 1000) — the number of available Beru-taxi cars nearby.

The i-th of the following n lines contains three integers xiyi 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 located at exactly the same point where Vasiliy lives.

Output

Print a single real value — the minimum time Vasiliy needs to get in any of the Beru-taxi cars. You answer will be considered correct if its absolute or relative error does not exceed 10 - 6.

Namely: let's assume that your answer is a, and the answer of the jury is b. The checker program will consider your answer correct, if .

Sample Input

Input
0 0
2
2 0 1
0 2 2
Output
1.00000000000000000000
Input
1 3
3
3 3 2
-2 3 6
-2 7 10
Output
0.50000000000000000000

Hint

In the first sample, first taxi will get to Vasiliy in time 2, and second will do this in time 1, therefore 1 is the answer.

In the second sample, cars 2 and 3 will arrive simultaneously.


/*题意:已知你的坐标和n个司机的坐标和速度,求上车的最短时间类型:水题分析:直接写就行了
*/
#include<cstdio>
#include<algorithm>
#include<queue>
#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
int main()
{int sx,sy,x,y,v,m;scanf("%d%d",&sx,&sy);double Min=0x7fffffff;scanf("%d",&m);while(m--){scanf("%d%d%d",&x,&y,&v);double res=sqrt((sx-x)*(sx-x)+(sy-y)*(sy-y));if(res*1.0/v<Min)Min=res*1.0/v;}printf("%.7f\n",Min);return 0;
}



更多推荐

CodeForces 706A Beru

本文发布于:2024-02-14 01:20:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1761385.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:CodeForces   Beru

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!