数据 表示每次到达某个位置的坐标和时间 计算出每对相邻点之间转移的速度(两点间距离距离/相隔时间) 输出最大值
Sample Input
2
5
2 1 9//t x y
3 7 2
5 9 0
6 6 3
7 6 0
10
11 35 67
23 2 29
29 58 22
30 67 69
36 56 93
62 42 11
67 73 29
68 19 21
72 37 84
82 24 98
Sample Output
9.2195444573
54.5893762558
# include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
# include <string>
# include <cmath>
# include <queue>
# include <list>
# define LL long long
using namespace std ; struct Point
{
double x,y,t; }p[]; double dist(Point a,Point b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
} int main()
{
//freopen("in.txt","r",stdin) ;
int T ;
scanf("%d" , &T) ;
while(T--)
{
int n ;
scanf("%d" , &n) ;
int i ;
double Max = ;
for (i = ; i < n ; i++)
{
scanf("%lf %lf %lf" , &p[i].t , &p[i].x , &p[i].y) ;
}
for (i = ; i < n- ; i++)
{
double t = dist(p[i], p[i+]) ;
t = t / (p[i+].t - p[i].t) ;
if (t > Max)
Max = t ;
}
printf("%.10lf\n" , Max) ; }
return ;
}