hdu 5078 Osu!(鞍山现场赛)

Osu!

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)

Total Submission(s): 20    Accepted Submission(s): 15

Special Judge

Problem 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 ti at place (xi, yi), and you should click it exactly at ti at (xi, yi). That means you should 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.

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, ti(0 ≤ ti < ti+1 ≤ 106),
xi, and yi (0 ≤ xi, yi ≤ 106) 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

2
5
2 1 9
3 7 2
5 9 0
6 6 3
7 6 0
10
11 35 67
23 2 29
29 58 22
30 67 69
36 56 93
62 42 11
67 73 29
68 19 21
72 37 84
82 24 98

Sample Output

9.2195444573
54.5893762558

Hint

In memory of the best osu! player ever Cookiezi.

求最大难度,难度为相邻两点的距离除以时间差。

代码:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <math.h>
using namespace std;
double a[10000];
double b[10000];
int ti[10000];
double dis(int i,int j)
{
    return sqrt((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j]));
}
int main()
{
    int t,n;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        double ans=0;

        for(int i=0;i<n;i++)
        {
            scanf("%d%lf%lf",&ti[i],&a[i],&b[i]);
        }
        for(int i=1;i<n;i++)
        {
            ans=max(ans,(dis(i-1,i)/(ti[i]-ti[i-1])));
        }
        printf("%.10f\n",ans);
    }
    return 0;
}
时间: 2024-08-24 19:14:57

hdu 5078 Osu!(鞍山现场赛)的相关文章

hdu 5078 2014鞍山现场赛 水题

http://acm.hdu.edu.cn/showproblem.php?pid=5078 现场最水的一道题 连排序都不用,因为说了ti<ti+1 //#pragma comment(linker, "/STACK:102400000,102400000") #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include &l

hdu 5078(2014鞍山现场赛 I题)

数据 表示每次到达某个位置的坐标和时间 计算出每对相邻点之间转移的速度(两点间距离距离/相隔时间) 输出最大值 Sample Input252 1 9//t x y3 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 Output9.219544457354.5893762558 1 # include <iostream> 2 #

hdu 5073 2014鞍山现场赛题 物理题

http://acm.hdu.edu.cn/showproblem.php?pid=5073 推公式即可,质心公式segma(xi*wi)/segma(wi) 最终剩下的一定是连续n-k个星 然后枚举左边需要移除几个星即可 计算I的时候展开来算 比较坑的地方在于,星星的位置如果是int型,一定记得Double计算的时候 *1.0或者直接将位置数组声明为double  否则WA到死... //#pragma comment(linker, "/STACK:102400000,102400000&q

HDU 5078 Osu!

题目链接:hdu 5078 Osu! 题面: Osu! Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1058    Accepted Submission(s): 550 Special Judge Problem Description Osu! is a very popular music game. Basically,

HDU 4815 2013长春现场赛C题

C - Little Tiger vs. Deep Monkey Time Limit:1000MS     Memory Limit:65535KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4815 Description A crowd of little animals is visiting a mysterious laboratory ? The Deep Lab of SYSU. "Are y

2014 acm鞍山现场赛总结

好像大家都习惯打完比赛写总结,我也来水一发好了.. 记一下流水账,那么多第一次献给了acm,不记一下就白去那么远的地方了.. 首先比赛前网上买了机票跟火车票了.比赛前一天早上6点钟起来收拾东西6点半坐地铁去机场.第一次来机场,太高大上啦,感觉就像大乡里入城差不多,这里的随便一个做前台的英语都完虐我几十条街,领了个机票傻乎乎的过了安检去了机票口,提前来了半个钟,逛了下机场的商店,尼玛全都没写价格,一看就知道各种贵,只好路上拍拍灰机场,吃了点垃圾食品就上机了,上机五分钟前发现还有个候机宝的东西,尼玛

hdu 5078 Osu! (2014 acm 亚洲区域赛鞍山 I)

题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=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 Description Osu! is a very p

hdu 5074 DP 2014鞍山现场赛题

hdu 5074 http://acm.hdu.edu.cn/showproblem.php?pid=5074 挺水的DP,注意依a[i-1]和a[i]的正负区分状态转移,然后O(n^3)即可轻易解决,我DP挺弱的也能过,貌似也就CF C题水平 //#pragma comment(linker, "/STACK:102400000,102400000") #include <cstdio> #include <cstring> #include <algo

ACM/ICPM2014鞍山现场赛D Galaxy (HDU 5073)

题目链接:pid=5073">http://acm.hdu.edu.cn/showproblem.php?pid=5073 题意:给定一条线上的点,然后能够去掉当中的m个,使剩下的到重心的距离最小, 因为重心等于距离的平均值.因此也就是求方差最小. 分析: 由于要去掉m个所以一定剩下n-m个,我们枚举这一串点的起始位置从1開始 一直枚举到m, 然后由平方和的公式展开.预处理一下前几项平方和.以及前几项的和就可以,复杂度为O(N); 代码例如以下: #include <iostream