hdu 5078
来源:互联网 发布:网络写作集剧本编写 编辑:程序博客网 时间:2024/05/29 15:11
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.
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.
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.
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.分析;求最大难度,最大难度为相邻两点距离比上时间差。用结构体存储,然后排序比较。#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>#include<cmath>using namespace std;struct st{ double t,x,y;}p[1005];double cal(st a,st b){ return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}int main(){ int t; cin>>t; while(t--) { int n; cin>>n; for(int i=0;i<n;i++) cin>>p[i].t>>p[i].x>>p[i].y; double maxx=0; for(int i=1;i<n;i++) { double item=cal(p[i],p[i-1]); item=item/(p[i].t-p[i-1].t); if(item>maxx) maxx=item; } printf("%.10f\n",maxx); } return 0;}
0 0
- hdu 5078
- hdu 5078
- hdu 5078 水题
- hdu 5078 Osu!
- [ACM] HDU 5078 Osu!
- hdu 5078 Osu!(水题)
- HDU 5078 Osu!
- HDU 5078 Osu!
- HDU 5078 Osu!
- HDU 5078--Osu!【水题】
- hdu 5078 Osu!
- hdu 5078 Osu!
- hdu 5078 Osu!(水)
- 小比赛(CodeForces 339D,POJ 1321,HDU 5078,HDU 2795,HDU 1385,HDU 1671,HDU 2923,POJ 2349)
- hdu
- hdu
- HDU
- hdu ()
- PX4飞控中利用EKF估计姿态角代码详解
- Liunx编程之信号signal
- 用数组作为函数返回值
- Android系统截屏功能提取
- Windows 7系统64位下vpn连接789错误解决方法
- hdu 5078
- 作业 5.19
- Android使用ViewPager实现左右切换02(转)
- poj1258 Agri-Net +hdu 1233 还是畅通工程 (最小生成树Prime算法)
- Django学习笔记(第四节)模板
- 仿《文明》游戏制作日志3
- 让WCF只需要配置服务地址
- 漫漫长日,匆匆十年:YC掌门人 Sam Altman 分享36条人生经验
- uva 10534题解(lis)