HDU 5078 Osu! (2014 ACM Asia semi-finals Anshan I)

Source: Internet
Author: User

Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 5078


Osu! Time Limit: 2000/1000 MS (Java/others) memory limit: 262144/262144 K (Java/Others)
Total submission (s): 180 accepted submission (s): 114
Special Judge


Problem descriptionosu! 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 TI at Place (XI, Yi), And You shoshould click it exactly at TI at (XI, yi ). 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 Ti AND Ti + 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.
Inputthe 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, Ti (0 ≤ Ti <Ti + 1 ≤ 106), XI, and Yi (0 ≤ XI, yi ≤106) as mentioned above.
Outputfor 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.5893762558HintIn memory of the best osu! player ever Cookiezi. 
 
Source2014 Asia Anshan Regional Contest
Recommendliuyiding | we have carefully selected several similar problems for you: 5081 5080 5079 5077
Statistic | submit | discuss | note


Remember to define the type as long to prevent overflow.


#include<iostream>#include<cstring>#include<cstdio>#include<algorithm>#include<cmath>#include<map>#include<set>#include<vector>#include<cstdlib>using namespace std;#define CLR(A) memset(A,0,sizeof(A))typedef long long ll;const int MAXN=1010;ll x[MAXN],y[MAXN],t[MAXN];int main(){    int T;    cin>>T;    while(T--){        int n;        cin>>n;        for(int i=0;i<n;i++) cin>>t[i]>>x[i]>>y[i];        double ans=0;        for(int i=1;i<n;i++){            double tmp=sqrt((x[i]-x[i-1])*(x[i]-x[i-1])+(y[i]-y[i-1])*(y[i]-y[i-1]))/(double)(t[i]-t[i-1]);            ans=max(ans,tmp);        }        printf("%.10lf\n",ans);    }    return 0;}




HDU 5078 Osu! (2014 ACM Asia semi-finals Anshan I)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.