A7790 | Running Student
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $(x_{i},0)$
- coordinates of all the stops are different
- the minibus drives at a constant speed, equal to $v_{b}$
- 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 $(x_{u},y_{u})$
- Student can run from a bus stop to the University at a constant speed $v_{s}$ 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.
奔跑的学生
再次,不幸降临在可怜的学生身上。他又迟到考试了。
匆匆赶到位于点 (0, 0) 的一个公交车站,他上了一辆小巴,它们沿着一条与OX轴平行的直线向着增加的x方向行驶。
可怜的学生知道以下事实:
- 在一次行驶中,小巴会停靠n次,第i次停靠在点 (x_i, 0)。
- 所有停靠点的坐标都是不同的。
- 小巴以恒定速度行驶,速度为$v_b$。
- 可以假设乘客在公交车站瞬间上下车。
- 学生只能在公交车站下车。
- 如果学生没有提前下车,他将在终点站下车。
- 考试地点大学位于点 (x_u, y_u)。
- 学生可以以恒定速度$v_s$从公交车站跑到大学,所需时间为何时。
- 两点之间的距离可以根据以下公式计算:$\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}$。
学生已经在小巴上了,所以他不能在第一个公交车站下车。
可怜的学生希望尽快到达大学。帮助他选择应该下车的公交车站。如果有多个这样的公交车站,选择离大学最近的公交车站。
感谢[Macw](https://www.acgo.cn/person/929871)提供翻译
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 $(x_{i},0)$
- coordinates of all the stops are different
- the minibus drives at a constant speed, equal to $v_{b}$
- 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 $(x_{u},y_{u})$
- Student can run from a bus stop to the University at a constant speed $v_{s}$ 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.
奔跑的学生
再次,不幸降临在可怜的学生身上。他又迟到考试了。
匆匆赶到位于点 (0, 0) 的一个公交车站,他上了一辆小巴,它们沿着一条与OX轴平行的直线向着增加的x方向行驶。
可怜的学生知道以下事实:
- 在一次行驶中,小巴会停靠n次,第i次停靠在点 (x_i, 0)。
- 所有停靠点的坐标都是不同的。
- 小巴以恒定速度行驶,速度为$v_b$。
- 可以假设乘客在公交车站瞬间上下车。
- 学生只能在公交车站下车。
- 如果学生没有提前下车,他将在终点站下车。
- 考试地点大学位于点 (x_u, y_u)。
- 学生可以以恒定速度$v_s$从公交车站跑到大学,所需时间为何时。
- 两点之间的距离可以根据以下公式计算:$\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}$。
学生已经在小巴上了,所以他不能在第一个公交车站下车。
可怜的学生希望尽快到达大学。帮助他选择应该下车的公交车站。如果有多个这样的公交车站,选择离大学最近的公交车站。
感谢[Macw](https://www.acgo.cn/person/929871)提供翻译
输入格式
The first line contains three integer numbers: $2<=n<=100$ , $1<=v_{b},v_{s}<=1000$ . The second line contains $n$ non-negative integers in ascending order: coordinates $x_{i}$ of the bus stop with index $i$ . It is guaranteed that $x_{1}$ equals to zero, and $x_{n}<=10^{5}$ . The third line contains the coordinates of the University, integers $x_{u}$ and $y_{u}$ , not exceeding $10^{5}$ in absolute value.
输入包含两行。
第一行输入三个整数,分别为 $2 \le n \le 1000, 1 \le v_b, v_s \le 1000$。
第二行输入 $n$ 个上升的非负整数,数字 $x_i$ 表示第二行读入的第 $i$ 个整数。保证 $x_n \le 10^5$,且 $x_1 = 0$。
输入包含两行。
第一行输入三个整数,分别为 $2 \le n \le 1000, 1 \le v_b, v_s \le 1000$。
第二行输入 $n$ 个上升的非负整数,数字 $x_i$ 表示第二行读入的第 $i$ 个整数。保证 $x_n \le 10^5$,且 $x_1 = 0$。
输出格式
In the only line output the answer to the problem — index of the optimum bus stop.
输出一个整数,代表本道题的答案。
输出一个整数,代表本道题的答案。
输入输出样例
输入 #1
4 5 2 0 2 4 6 4 1
输出 #1
3
输入 #2
2 1 1 0 100000 100000 100000
输出 #2
2
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.
**请注意,本题空间限制为64MB,是默认空间限制的二分之一。**
**请注意,本题空间限制为64MB,是默认空间限制的二分之一。**
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted