//#define LOCAL
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mem(a, b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define DNF 0x7f
#define DBG printf("this is a input\n")
#define fi first
#define se second
#define mk(a, b) make_pair(a,b)
#define pb push_back
#define p_queue priority_queue
#define CLOSE ios::sync_with_stdio(0); cin.tie(0)
void FileIO()
{
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("odata.out", "w", stdout);
#endif
}
ll gcd(ll a, ll b) {
return b == 0 ? a : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
return a / gcd(a, b) * b;
}
const int N = 25010;
int n , m;
int x[N] , y[N] , dx[N], dy[N], s[N];
double c[N];
int main(void) {
scanf("%d",&n);
for (int i = 1; i <= n; i++)
{
scanf("%d %d %d %d %d",&x[i], &y[i], &dx[i], &dy[i], &s[i]);
c[i] = s[i] / sqrt( dx[i]*dx[i] + dy[i]*dy[i]);
}
double ans = DBL_MAX;
for (int i = 1 ; i <= n ; i ++)
{
for (int j = i + 1 ; j <= n ; j ++)
{
//叉乘
int cc = dx[j] * dy[i] - dx[i] * dy[j];
int dey = y[j] - y[i];
int dex = x[j] - x[i];
if(cc != 0)
{
double t1 = 1.0 * (dx[j] * dey - dy[j] * dex) / (c[i] * cc);
double t2 = 1.0 * (dx[i] * dey - dy[i] * dex) / (c[j] * cc);
if(t1 >= 0 && t2 >= 0)
ans = min(ans,max(t1,t2));
}
else if ((x[i] - x[j]) * dy[j] == (y[i] - y[j]) * dx[j])
{
int v = 0;
if(dex * dx[i] > 0) v += s[i];
if(dex * dx[j] < 0) v += s[j];
if(v > 0)
ans = min (ans , 1.0 * sqrt(dex*dex+dey*dey) / v);
}
}
}
if(ans == DBL_MAX)
printf("No show :(\n");
else
printf("%.8lf", ans);
}
EDU88 F. RC Kaboom Show 2900分计算几何之大力出奇迹
最新推荐文章于 2024-09-10 09:49:04 发布