In anshan, calculate the distance between two points divided by the maximum value of time. Directly violent.
A-Osu!
Time limit:1000 ms
Memory limit:262144kb
64bit Io format:% I64d & % i64usubmit status practice HDU 5078 appoint description: System crawler)
Description
Osu! Is a very popular music game. Basically, it is a game about clicking. Some points will appear on the screen at some time, and you have to click them at a correct time.
Now, you want to write an algorithm to estimate how diffecult a game is.
To simplify the things, in a game consisting of n points, point I will occur at time t I at Place (x I, y I ), and you shoshould click it exactly at t iat (x I, y I ). that means you shoshould move your cursor from point I to point I + 1. this movement is called a jump, and the difficulty of a jump is just the distance between point I and point I + 1 divided by the time between t I and t I + 1. and the difficulty of a game is simply the difficulty of the most difficult jump in the game.
Now, given a description of a game, Please calculate its difficulty.
Input
The first line contains an integer T (T ≤ 10), denoting the number of the test cases.
For each test case, the first line contains an integer N (2 ≤ n ≤1000) denoting the number of the points in the game. then n lines follow, the I-th line consisting of 3 space-separated integers, t I (0 ≤ t I <t I + 1 ≤ 10 6), x I, and y I (0 ≤ x I, y I ≤ 10 6) as mentioned above.
Output
For each test case, output the answer in one line.
Your answer will be considered correct if and only if its absolute or relative error is less than 1e-9.
Sample Input
252 1 93 7 25 9 06 6 37 6 01011 35 6723 2 2929 58 2230 67 6936 56 9362 42 1167 73 2968 19 2172 37 8482 24 98
Sample output
9.219544457354.5893762558
Hint
In memory of the best osu! player ever Cookiezi.
1 #include<cstdio> 2 #include<algorithm> 3 #include<cmath> 4 #include<stdlib.h> 5 using namespace std; 6 const int maxn=1000+10; 7 struct 8 { 9 double t;10 double x;11 double y12 ;13 }Node[maxn];14 int main()15 {16 int T;17 scanf("%d",&T);18 while(T--)19 {20 int N;21 double maxd=-1;22 scanf("%d",&N);23 for(int i=0;i<N;i++)24 scanf("%lf%lf%lf",&Node[i].t,&Node[i].x,&Node[i].y);25 for(int i=0;i<N;i++)26 {27 for(int j=i+1;j<N;j++)28 {29 double time=sqrt((Node[i].x-Node[j].x)*(Node[i].x-Node[j].x)+(Node[i].y-Node[j].y)*(Node[i].y-Node[j].y))/fabs(Node[i].t-Node[j].t);30 maxd=max(maxd,time);31 }32 }33 printf("%.10lf\n",maxd);34 }35 return 0;36 }
2014acm/ICPC regional Anshan Division Field Competition 1009osu!