2014 Asia AnShan Regional Contest --- HDU 5078 Osu!

时间:2022-12-17 15:35:55

Osu!

Problem's Link:   http://acm.hdu.edu.cn/showproblem.php?pid=5078


Mean:

略。

analyse:

签到题,直接扫一遍就得答案,但是现场赛的时候也是卡了好久,估计队友也是被爆int坑了吧。

Time complexity: O(n)

Source code: 

//  Memory   Time
// 1347K 0MS
// by : Snarl_jsb
// 2014-11-15-10.58
#include<algorithm>
#include<iomanip>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<climits>
#include<cmath>
#define N 1000010
#define LL long long
using namespace std;
LL val[1005][3];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
// freopen("C:\\Users\\ASUS\\Desktop\\cin.cpp","r",stdin);
// freopen("C:\\Users\\ASUS\\Desktop\\cout.cpp","w",stdout);
int t,n;
cin>>t;
while(t--){
cin>>n;
double res=-1e9;
for(int i=0;i<n;++i){
cin>>val[i][0]>>val[i][1]>>val[i][2];
if(i) res=max(res,sqrt((val[i][1]-val[i-1][1])*(val[i][1]-val[i-1][1])+(val[i][2]-val[i-1][2])*(val[i][2]-val[i-1][2]))/(val[i][0]-val[i-1][0]));
}
cout<<setprecision(10)<<res<<endl;
}
return 0;
}
/* */