Tom and Jerry are going on a vacation. They are now driving on a one-way road and several cars are in front of them. To be more specific, there are nn cars in front of them. The iith car has a length of lili, the head of it is sisi from the stop-line, and its maximum velocity is vivi. The car Tom and Jerry are driving is l0l0 in length, and s0s0from the stop-line, with a maximum velocity of v0v0. 
The traffic light has a very long cycle. You can assume that it is always green light. However, since the road is too narrow, no car can get ahead of other cars. Even if your speed can be greater than the car in front of you, you still can only drive at the same speed as the anterior car. But when not affected by the car ahead, the driver will drive at the maximum speed. You can assume that every driver here is very good at driving, so that the distance of adjacent cars can be kept to be 00. 
Though Tom and Jerry know that they can pass the stop-line during green light, they still want to know the minimum time they need to pass the stop-line. We say a car passes the stop-line once the head of the car passes it. 
Please notice that even after a car passes the stop-line, it still runs on the road, and cannot be overtaken.

InputThis problem contains multiple test cases. 
For each test case, the first line contains an integer nn (1≤n≤105,∑n≤2×1061≤n≤105,∑n≤2×106), the number of cars. 
The next three lines each contains n+1n+1 integers, li,si,vili,si,vi (1≤si,vi,li≤1091≤si,vi,li≤109). It's guaranteed that si≥si+1+li+1,∀i∈[0,n−1]si≥si+1+li+1,∀i∈[0,n−1]OutputFor each test case, output one line containing the answer. Your answer will be accepted if its absolute or relative error does not exceed 10−610−6. 
Formally, let your answer be aa, and the jury's answer is bb. Your answer is considered correct if |a−b|max(1,|b|)≤10−6|a−b|max(1,|b|)≤10−6. 
The answer is guaranteed to exist.Sample Input

1
2 2
7 1
2 1
2
1 2 2
10 7 1
6 2 1

Sample Output

3.5000000000
5.0000000000 思路参考博客:https://blog.csdn.net/mmk27_word/article/details/96896277 代码:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<map>
#include<cmath>
const int maxn=1e5+;
typedef long long ll;
using namespace std;
double S[maxn],V[maxn],L[maxn],sum[maxn];
int main()
{
int n;
while(cin>>n)
{
for(int t=;t<=n+;t++)
{
scanf("%lf",&L[t]);
sum[t]=sum[t-]+L[t];
}
for(int t=;t<=n+;t++)
{
scanf("%lf",&S[t]);
}
for(int t=;t<=n+;t++)
{
scanf("%lf",&V[t]);
}
double ans=;
for(int t=;t<=n+;t++)
{
ans=max(ans,(S[t]+sum[t]-L[])/V[t]);
}
printf("%.10f\n",ans);
}
return ;
}

HDU多校-1004-Vacation(思维)的更多相关文章

  1. hdu多校1004 Distinct Values

    Distinct Values Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): ...

  2. 2018 HDU多校第四场赛后补题

    2018 HDU多校第四场赛后补题 自己学校出的毒瘤场..吃枣药丸 hdu中的题号是6332 - 6343. K. Expression in Memories 题意: 判断一个简化版的算术表达式是否 ...

  3. 2018 HDU多校第三场赛后补题

    2018 HDU多校第三场赛后补题 从易到难来写吧,其中题意有些直接摘了Claris的,数据范围是就不标了. 如果需要可以去hdu题库里找.题号是6319 - 6331. L. Visual Cube ...

  4. 2015 HDU 多校联赛 5363 Key Set

    2015 HDU 多校联赛 5363 Key Set 题目: http://acm.hdu.edu.cn/showproblem.php? pid=5363 依据前面给出的样例,得出求解公式 fn = ...

  5. 2015 HDU 多校联赛 5317 RGCDQ 筛法求解

    2015 HDU 多校联赛 5317 RGCDQ 筛法求解 题目  http://acm.hdu.edu.cn/showproblem.php? pid=5317 本题的数据量非常大,測试样例多.数据 ...

  6. HDU 6187 Destroy Walls (思维,最大生成树)

    HDU 6187 Destroy Walls (思维,最大生成树) Destroy Walls *Time Limit: 8000/4000 MS (Java/Others) Memory Limit ...

  7. [HDU多校]Ridiculous Netizens

    [HDU多校]Ridiculous Netizens 点分治 分成两个部分:对某一点P,连通块经过P或不经过P. 经过P采用树形依赖背包 不经过P的部分递归计算 树型依赖背包 v点必须由其父亲u点转移 ...

  8. hdu多校第一场1004(hdu6581)Vacation 签到

    题意:有n+1辆车,每辆车都有一定的长度,速度和距离终点的距离,第1-n辆车在前面依次排列,第0辆车在最后面.不允许超车,一旦后车追上前车,后车就减速,求第0辆车最快什么时候能到达终点? 思路:对于每 ...

  9. 2017多校第9场 HDU 6161 Big binary tree 思维,类似字典树

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6161 题意: 题目是给一棵完全二叉树,从上到下从左到右给每个节点标号,每个点有权值,初始权值为其标号, ...

随机推荐

  1. 基于视频压缩的实时监控系统-sprint2采集端图像采集子系统设计

    (1).初始化:a.初始化摄像头:b.注册事件到epoll (2).开始采集--->触发事件处理系统 (3).保存图像(方便测试) a.初始化摄像头 //初始化摄像头 1.获取驱动信息 2.设置 ...

  2. Linux本地套接字(Unix域套接字)----SOCK_DGRAM方式

    目录 简述 创建服务端代码: 创建客户端代码 接收函数封装 发送封装 服务端测试main函数 客户端测试main函数 编译运行结果 简述 这里介绍一下Linux进程间通信的socket方式---Loc ...

  3. 16、Java中级进阶 面向对象 封装

    1.封装概述 封装可以被认为是一个保护屏障,将类的某些信息隐藏在类内部,不允许外部程序直接访问,而是通过类提供的方法来实现对隐藏信息的操作访问,可以有效的防止该类的代码和数据被其他类随意访问. 要访问 ...

  4. [问题记录] webpack devServer HtmlWebpackPlugin 没有加载 js、css

    webpack devServer 没有加载 js.css HtmlWebpackPlugin runtimeChunks 注入问题. 描述 写了一个极其简单的多页面 demo 启动开发服务器,发现样 ...

  5. 关于import android.support.v4.app.ContextCompat;找不到contextcompat的解决方法

    android迁移到了androidx,那么相关库的import就有问题了,需要转变为androidx的,这里比如 import android.support.v4.app.ContextCompa ...

  6. 博客主题推荐——复杂&简单

    首先感谢原作者cjunn提供的主题autm,以下配置都基于此主题设定.很多小伙伴喜欢现在的样式,分享如下.只需简单几步即可. 如果你想使用本博客主题样式,并希望能得到远程推送更新,只需查看 快速部署. ...

  7. 如何有效防止sql注入

    SQL注入攻击是黑客对数据库进行攻击常用的手段之一,随着B/S模式应用开发的发展,使用这种模式编写应用程序的程序员也越来越多.但是由于程序员的水平及经验参差不齐,相当大一部分程序员在编写代码的时候,没 ...

  8. java 访问修饰符与代码块

    一 访问修饰符 要想本包中的类都可以访问不加修饰符即可:  要想仅能在本类中访问使用private修饰: 要想本包中的类与其他包中的子类可以访问使用protected修饰 要想所有包中的所有类都可以访 ...

  9. Django-Model模型Field选项中null和blank的区别

    - Option-**blank**设置为True时代表填写表单的时候可以为空,即在save()执行时此字段可以没有,如果字段没有就在数据库上存储一个空字符串: - Option-**null**设置 ...

  10. 2020-07-11:session和cookie的区别是什么?

    福哥答案2020-07-11: 1.保存位置:session服务端.cookie客户端.2.安全性:session相对安全,cookie相对不安全.3.存储类型:session能够存储任意的对象,co ...