数学水题

    xiaoxiao2026-06-04  8

    Beru-taxi Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit  Status  Practice  CodeForces 706A Appoint description:  System Crawler  (Aug 12, 2016 10:47:45 AM)

    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 ≤ 1001 ≤ 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

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 #include<cstdio> #include<cstring> #include<algorithm> #define M 0xffffff #include<cmath> using namespace std; int x,y,v; int main() { int n,a,b; double s,t; while(~scanf("%d%d",&a,&b)) { scanf("%d",&n); t=M; for(int i=1;i<=n;i++) { scanf("%d%d%d",&x,&y,&v); s=sqrt((x-a)*(x-a)+(y-b)*(y-b))/v; t=min(t,s); } printf("%.16lf\n",t); } return 0; }

    转载请注明原文地址: https://ju.6miu.com/read-1310190.html
    最新回复(0)