题意:n个人要运动ll长,有个bus带其中几个人,问最短时间
最后所有人在同一时间到终点是用时最少的。由于搭bus相当于加速,每个人的加速时间应该一样。先计算bus走过的路程route。看第一个人被搭t分钟(也就是所有人以后都搭t分钟),剩余的人走t分钟,route+=v2*t。bus到了v2*t的位置,人在v1*t的位置。bus回去接人,被接的人继续前进。route2=(v2*t-v1*t)/(v1+v2)*v2(相向而行)。接到人后再走v2*t,结果就是这样往复。最后一次不回头。如果要接a次人,那路程就是a*v2*t+(a-1)*route2。这里只有t未知。第一个被放的人走到终点要(ll-v2*t)/v1,要等于bus走过剩下距离的时间。
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <cassert>
using namespace std;
const double EPS=1e-;
const int SZ=,INF=0x7FFFFFFF;
typedef long long lon; int main()
{
std::ios::sync_with_stdio();
//freopen("d:\\1.txt","r",stdin);
double n,ll,v1,v2,maxnum;
cin>>n>>ll>>v1>>v2>>maxnum;
int time=ceil(n/maxnum);
double lft=ll/v1;
double co=v2/v1+time-+(time-)*(v2-v1)/(v1+v2);
double t=lft/co;
//cout<<t<<endl;
t+=(ll-v2*t)/v1;
cout<<fixed<<setprecision()<<t<<endl;
return ;
}