Running Student(翻译)

该问题是一个关于路径规划和最短时间计算的问题。学生需要在公交车沿线的某个站点下车,然后跑步前往大学,目标是最小化总耗时。已知公交车停靠n个站点,每个站点的位置,以及学生和公交车的速度。学生不能在第一个站点下车,且最终必须到达大学。解决方案是找出使学生总时间最短的下车站点,并考虑如果多个站点具有相同最短时间,则选择距离大学最近的站点。
摘要由CSDN通过智能技术生成

2022.2.5

题目网址:

https://codeforces.com/contest/9/problem/B

原题:

Running Student

 1000ms  65536K

描述:

And again a misfortune fell on Poor Student. He is being late for an exam.

Having rushed to a bus stop that is in point (0, 0), he got on a minibus and they drove along a straight line, parallel to axis OX, in the direction of increasing x.

Poor Student knows the following:

  • during one run the minibus makes n stops, the i-th stop is in point (xi, 0)
  • coordinates of all the stops are different
  • the minibus drives at a constant speed, equal to vb
  • it can be assumed the passengers get on and off the minibus at a bus stop momentarily
  • Student can get off the minibus only at a bus stop
  • Student will have to get off the minibus at a terminal stop, if he does not get off earlier
  • the University, where the exam will be held, is in point (xu, yu)
  • Student can run from a bus stop to the University at a constant speed vs as long as needed
  • a distance between two points can be calculated according to the following formula:
  • Student is already on the minibus, so, he cannot get off at the first bus stop

Poor Student wants to get to the University as soon as possible. Help him to choose the bus stop, where he should get off. If such bus stops are multiple, choose the bus stop closest to the University.

输入:

The first line contains three integer numbers: 2 ≤ n ≤ 100, 1 ≤ vb, vs ≤ 1000. The second line contains n non-negative integers in ascending order: coordinates xi of the bus stop with index i. It is guaranteed that x1 equals to zero, and xn ≤ 105. The third line contains the coordinates of the University, integers xu and yu, not exceeding 105 in absolute value.

输出:

In the only line output the answer to the problem — index of the optimum bus stop.

注释:

As you know, students are a special sort of people, and minibuses usually do not hurry. That's why you should not be surprised, if Student's speed is higher than the speed of the minibus.

翻译:

描述:

不幸再次落到了这个穷学生身上。他考试迟到了。

匆匆赶到一个在点(0,0)的公交车站,他上了一辆小型公共汽车然后他们沿一条直线驶去,平行于OX轴,X轴正方向。

这个穷学生知道以下规则:

在小型公共汽车行驶n站的途中,第i站在点(xi,0)

所有站点的坐标都是不同的

小型公共汽车以一个常速vb进行

我们认为乘客会随时在一个公共汽车站点上车下车

学生只能在一个公共汽车站下车

如果学生没有早点下车的话,那么他必须在终点站下车

考试举行的大学坐标为(xu,yu)

如果需要的话学生可以以一个常速vs从一个公共汽车站跑到这个大学

两点之间的距离是可以根据以下距离公式计算的

学生已经在这个小型公共汽车上了,所以,他不能在第一个公共汽车站下车

这个穷学生想尽可能快到达这个大学。请帮助他选择他一个下车的公共汽车站。

如果这样的汽车站有多种,那么选择离这个大学最近的汽车站。

输入:

第一行包含三个整数数字:2<=n<=100,1<=vb,vs<=1000。第二行包含n个非负整数:

xi个汽车站的坐标。保证x1等于0,xn<=105。第三行包含这个大学的坐标,整数xu和yu,绝对值不超过105。

输出:

唯一一行输出这个问题的答案---最佳公共汽车站是第几个。

注释:

就像你所知道的,学生是人们中的特殊的一种,小型公共汽车通常不太急。那就是为什么你如果学生的速度比小型公共汽车的速度大的话,你不应该感到惊讶。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值