008 Vacation

队里的作业 直接贴过来了
问题描述:
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 n cars in front of them. The ith car has a length of li, the head of it is si from the stop-line, and its maximum velocity is vi. The car Tom and Jerry are driving is l0 in length, and s0 from the stop-line, with a maximum velocity of v0.
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 0.
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.

大意:
Tom和Jerry在单行道上行车,前面有n辆车。第i辆车的长度为li,车头距停车线si,最大速度为vi,Tom和Jerry驾驶的车长度为l0,距停车线s0,最大速度为v0。当速度大的车追上前面的车时,将被迫与前车保持同样速度,而距离为0。一辆车通过停车线后仍在行驶,不能超车。试求他们能通过(车头)停车线的最短时间。
输入格式:
This problem contains multiple test cases.
For each test case, the first line contains an integer n (1≤n≤105,∑n≤2×106), the number of cars.
The next three lines each contains n+1 integers, li,si,vi (1≤si,vi,li≤109). It’s guaranteed that si≥si+1+li+1,∀i∈[0,n−1]

输出格式:
For each test case, output one line containing the answer. Your answer will be accepted if its absolute or relative error does not exceed 10−6.
Formally, let your answer be a, and the jury’s answer is b. Your answer is considered correct if |a−b|max(1,|b|)≤10−6.
The answer is guaranteed to exist.
分析:
我们的车可能与前方的n辆车贴在一起,此时我们到达的时间为:(n指贴在一起的最前方的车)
(s(n)+∑_1^n▒〖l(i)〗)⁄(v(n))
没有与车紧紧相连时的时间:
s(0)⁄(v(0))
只要依此排查上指求最大值即可,水
代码:

#include
#include
using namespace std;
const int _MAX = 1e5 + 10;
int s[_MAX],v[_MAX],l[_MAX];
int main()
{
int n;
while(cin>>n)
{
for(int i = 0;i <= n;i++)
scanf("%d",&l[i]);//一开始用的cin因为数据太多会超时
for(int i= 0;i <= n;i++)
scanf("%d",&s[i]);
for(int i = 0;i <= n;i++)
scanf("%d",&v[i]);
double ans = s[0]*1.0/v[0];
long long int sum = 0;
for(int i = 1;i <= n;i++)
{
sum+=l[i]; //用来计算1~n个l的总和
ans=max((sum+s[i])*1.0/v[i],ans);
}
printf("%.10f\n",ans);
}
return 0;
}

`

资源下载链接为: https://pan.quark.cn/s/22ca96b7bd39 在当今的软件开发领域,自动化构建与发布是提升开发效率和项目质量的关键环节。Jenkins Pipeline作为一种强大的自动化工具,能够有效助力Java项目的快速构建、测试及部署。本文将详细介绍如何利用Jenkins Pipeline实现Java项目的自动化构建与发布。 Jenkins Pipeline简介 Jenkins Pipeline是运行在Jenkins上的一套工作流框架,它将原本分散在单个或多个节点上独立运行的任务串联起来,实现复杂流程的编排与可视化。它是Jenkins 2.X的核心特性之一,推动了Jenkins从持续集成(CI)向持续交付(CD)及DevOps的转变。 创建Pipeline项目 要使用Jenkins Pipeline自动化构建发布Java项目,首先需要创建Pipeline项目。具体步骤如下: 登录Jenkins,点击“新建项”,选择“Pipeline”。 输入项目名称和描述,点击“确定”。 在Pipeline脚本中定义项目字典、发版脚本和预发布脚本。 编写Pipeline脚本 Pipeline脚本是Jenkins Pipeline的核心,用于定义自动化构建和发布的流程。以下是一个简单的Pipeline脚本示例: 在上述脚本中,定义了四个阶段:Checkout、Build、Push package和Deploy/Rollback。每个阶段都可以根据实际需求进行配置和调整。 通过Jenkins Pipeline自动化构建发布Java项目,可以显著提升开发效率和项目质量。借助Pipeline,我们能够轻松实现自动化构建、测试和部署,从而提高项目的整体质量和可靠性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值