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. 【转载】requests库的7个主要方法、13个关键字参数以及响应对象的5种属性

    Python爬虫常用模块:requests库的7个主要方法.13个关键字参数以及响应对象的5种属性 原文链接: https://zhuanlan.zhihu.com/p/67489739

  2. python2.5项目:个税计算器程序

    #开发个税计算器:应纳税所得额=工资收入金额-各项社会保险费-起征点(5000元)应纳税额=应纳税所得额*税率—速算扣除数(税率参考图片)m=float(input("请输入你的税前工资:& ...

  3. 032_go语言中的定时器

    代码演示 package main import "fmt" import "time" func main() { timer1 := time.NewTim ...

  4. cxuan读者的外包面试之旅

    最开始是打算面试外包公司刷经验,等经验差不多了,再去甲方尝试,可惜不太顺利. 一.迈思(面试了30分钟) 自我介绍 左连接(a 表左连接 b 表,a 表全部数据出来,b 表没有的数据为空) a 表左连 ...

  5. 《Python测试开发技术栈—巴哥职场进化记》—软件测试工程师“兵器库”

    上文<Python测试开发技术栈-巴哥职场进化记>-初来乍到,请多关照 我们介绍了巴哥入职后见到了自己的导师华哥,第一次参加团队站会,认识了团队中的开发小哥哥和产品小姐姐以及吃到了公司的加 ...

  6. 2020-07-02:在浏览器输入一个url后按回车,会发生什么?

    福哥答案2020-07-02: 简单回答: 域名解析. 建立TCP连接. 请求. 处理. 响应. 释放TCP连接. 页面渲染. 中级回答: 域名解析 浏览器DNS缓存. 操作系统DNS缓存. 路由器缓 ...

  7. Windows下 Navicat Premium 15安装教程(图文,含注册)

    版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. 本文链接:https://www.cnblogs.com/zhangzhicheng1996/ ...

  8. 【算法•日更•第二十八期】图论:强连通+Tarjan算法(一)

    ▎前言 一直都想学习这个东西,以为很难,结果发现也不过如此. 只要会些图论的基础就可以了. ▎强连通 ☞『定义』 既然叫强连通,那么一定具有很强的连通性. 强连通:就是指在一个有向图中,两个顶点可以互 ...

  9. windows 服务端 狼人杀 发牌器 开发完成 待继续开发其他服务

    开发工具: python2.7 eric4 成果链接地址 https://wws.lanzous.com/iPCDTfnuoif

  10. Elasticsearch聚合语句

    聚合的范围是search query过滤出的数据 四种聚合类型: 一.Bucketing 桶聚合,常规的分类然后计算每个分类的文档数量 二.Metric 分类并对一组文档进行sum.avg等数学运算 ...