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 algZ喎?http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vcml0aG0gdG8gZXN0aW1hdGUgaG93IGRpZmZlY3VsdCBhIGdhbWUgaXMuPGJyPgo8YnI+ClRvIHNpbXBsaWZ5IHRoZSB0aGluZ3MsIGluIGEgZ2FtZSBjb25zaXN0aW5nIG9mIE4gcG9pbnRzLCBwb2ludCBpIHdpbGwgb2NjdXIgYXQgdGltZSB0PHN1Yj5pPC9zdWI+IGF0IHBsYWNlICh4PHN1Yj5pPC9zdWI+LCB5PHN1Yj5pPC9zdWI+KSwgYW5kIHlvdSBzaG91bGQgY2xpY2sgaXQgZXhhY3RseSBhdCB0PHN1Yj5pPC9zdWI+IGF0ICh4PHN1Yj5pPC9zdWI+LCB5PHN1Yj5pPC9zdWI+KS4gVGhhdCBtZWFucyB5b3Ugc2hvdWxkIG1vdmUgeW91ciBjdXJzb3IKIGZyb20gcG9pbnQgaSB0byBwb2ludCBpJiM0MzsxLiBUaGlzIG1vdmVtZW50IGlzIGNhbGxlZCBhIGp1bXAsIGFuZCB0aGUgZGlmZmljdWx0eSBvZiBhIGp1bXAgaXMganVzdCB0aGUgZGlzdGFuY2UgYmV0d2VlbiBwb2ludCBpIGFuZCBwb2ludCBpJiM0MzsxIGRpdmlkZWQgYnkgdGhlIHRpbWUgYmV0d2VlbiB0PHN1Yj5pPC9zdWI+IGFuZCB0PHN1Yj5pJiM0MzsxPC9zdWI+LiBBbmQgdGhlIGRpZmZpY3VsdHkgb2YgYSBnYW1lIGlzIHNpbXBseSB0aGUgZGlmZmljdWx0eQogb2YgdGhlIG1vc3QgZGlmZmljdWx0IGp1bXAgaW4gdGhlIGdh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bGFzcz0="brush:java;">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
HintIn memory of the best osu! player ever Cookiezi.
求最大難度,難度為相鄰兩點的距離除以時間差。
代碼:
#include
#include
#include
#include
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