#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
const int maxn=200005;
int n,x[maxn],y[maxn],s[maxn];
bool judge(long double v)
{
long double t=0;
for(int i=1;i<=n;i++)
{
if(t+s[i]/v>y[i]) return 0;
if(t+s[i]/v<x[i]) t=x[i];
else t=t+s[i]/v;
}
return 1;
}
/*
int erfen(long double l,long double r)
{
if(r-l<=1e-9) return (l+r)/2.00;
else
{
long double mid=(l+r)/2.00;
if(judge(mid)) erfen(l,mid);
else erfen(mid,r);
}
}*/
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d%d%d",&x[i],&y[i],&s[i]);
}
long double l=0,r=1e9,mid;
while(r-l>1e-9)
{
mid=(l+r)/2;
if(judge(mid)) r=mid;
else l=mid;
}
// long double ans=erfen(0,1e9);
printf("%.2lf",(double)l);
}
P1542 包裹快递(二分)
最新推荐文章于 2022-10-13 20:32:52 发布