题意:计算两次输入之间点的距离除以时间的最大值
错误:输入最大是1e6,距离会超过32位整数的范围
代码如下:
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
int main()
{
// freopen("data.txt","r",stdin);
int T;
scanf("%d",&T);
while(T--)
{
int n;
scanf("%d",&n);
double ans=0;
int lt,lx,ly;
for(int i=0;i<n;++i)
{
int t,x,y;
scanf("%d%d%d",&t,&x,&y);
if(i!=0)
{
double tmp=(ll)(x-lx)*(x-lx)+(ll)(y-ly)*(y-ly);
tmp=sqrt(tmp);
tmp/=(t-lt);
ans=max(ans,tmp);
}
lt=t;
lx=x;
ly=y;
}
printf("%.9lf\n",ans);
}
return 0;
}