hdu5078 Osu!
来源:互联网 发布:上海高级美工培训 编辑:程序博客网 时间:2024/05/17 23:44
Osu!
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 2259 Accepted Submission(s): 1220
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.
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<cstdio>#include<cmath>int main(){int t;scanf("%d",&t);while(t--){int n;double ans=0,ti[1010],x[1010],y[1010];scanf("%d",&n);for(int i=1;i<=n;i++) scanf("%lf%lf%lf",&ti[i],&x[i],&y[i]);for(int i=1;i<n;i++){double temp=sqrt((x[i]-x[i+1])*(x[i]-x[i+1])+(y[i]-y[i+1])*(y[i]-y[i+1]));temp=temp/fabs(ti[i]-ti[i+1]);if(temp>ans)ans=temp;}printf("%.10lf\n",ans);}return 0;}
0 0
- hdu5078 Osu!
- HDU5078 2014 ACM-ICPC亚洲区域赛鞍山赛区现场赛I题 Osu! 签到题
- hdu5078(贪心)
- osu
- hdu5078 hdu5074 顺便写一写鞍山
- hd5078 Osu!
- 【BZOJ4318】OSU!
- [BZOJ4318] OSU!
- bzoj4318: OSU!
- BZOJ4318: OSU!
- BZOJ4318: OSU!
- 【jzoj4783】【Osu】
- [bzoj4318]OSU!
- hdu 5003 Osu!(水题)
- hdu 5078 Osu!
- [ACM] HDU 5078 Osu!
- hdu 5078 Osu!(水题)
- HDU 5078 Osu!
- HRBUST1315-火影忍者之~大战之后
- 简单易用的json解析,json生成器和基于JSONArray和JSONObject for Android的数据存储
- 2017.3.5
- 关于GetWindowTextA()和GetWindowTextW()和GetWindowText()的区别
- Dijkstra算法详解
- hdu5078 Osu!
- 十道海量数据处理面试题与十个方法大总结
- CreateWindow中dwStyle设置为WS_POPUP时显示不出来
- jquery.cookie.js的使用方法
- 用大白话聊聊分布式系统
- 股票基础:基本术语
- 仿《雷霆战机》飞行射击手游开发--新手引导
- caffe 框架下微调已有模型训练自己的数据实现图像分类
- jsp之转发与重定向