题意:当前车面前有n辆车,也就是说一共n+1辆车只能排成一排,然后每辆车有s(到停车线的距离),v(最大速度),l(车的长度),问你最快多少时间能让最后一辆车的车头到达停车线
题解:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <queue>
using namespace std;
const int maxn = 1e5+5;
const double eps = 1e-8;
const double INF = 1e20;
const double pi = acos (-1.0);
typedef long long int ll;
double l[maxn],s[maxn],v[maxn];
double tmps[maxn];
int n;
int dcmp(double x){
if(fabs(x)<eps)return 0;
else if(x>0)return 1;
else return -1;
}
int check(double x){
for(int i=1;i<=n;i++)tmps[i]=s[i];
for(int i=1;i<=n;i++){
tmps[i]-=x*v[i];