2021.2.22 I题题解
题目大意及其思路
给出n个点出现的时间以及二维图纸上的坐标,然后求最大难度(最大难度等于两点相隔的距离/两点相隔的时间)
思路的话.....读懂题目意思后面写的话也差不多了
代码如下
#include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;
struct jiegou
{
double t,x,y;
}a[1010];
double k (jiegou a,jiegou b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
void w()
{
int i,n;
double jg=0,cc;
cin >> n;
for(i=0;i<n;i++)
{
cin >> a[i].t >> a[i].x >> a[i].y;
}
for( i=0;i< n;i++)
{
cc=k(a[i],a[i+1])/(a[i+1].t-a[i].t);
if(cc>=jg)jg=cc;
}
printf("%.10lf\n",jg);
}
int main()
{
int T;
cin >> T ;
while(T--)w();
return 0;
}