Running Student
题目(https://acs.jxnu.edu.cn/problem/CF9B)描述:
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.
样例输入:
4 5 2
0 2 4 6
4 1
样例输出:
3
样例输入:
2 1 1
0 100000
100000 100000
样例输出:
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.
翻译:
并且再一次不幸降临到了这个贫穷的学生身上。他考试要迟到了。
他已经冲到了坐标为(0,0)的汽车站,他已经上了车,车直线开着,平行坐标轴OX,正向移动。
他知道接下来的事:
1:汽车跑一趟会经停n站,第i站的坐标是(xi,0);
2:所有站的坐标不同
3:汽车以恒定速度vb向前行驶
4:假设乘客上下车瞬间完成
5:他只能在一个站台下车
6:如果他不早点下车,他将不得不到终点站下车
7:举办考试的学校的坐标为(xu,yu)
8:他可以以恒定速度vs从站台跑向学校
9:两点的距离可以按如图所示的方法计算(图不见了)
10:学生已经在车上了,所以他不能从第一站下车
学生想要尽可能快的到达学校。帮助他选择他需要下车的车站。如果可以选择的车站很多,选择离学校最近的那个。
输入:
第一行输入三个整数2 ≤ n ≤ 100, 1 ≤ vb, vs ≤ 1000。第二行包含按序排好的n个非负整数,第i个数表示第i个车站的横坐标xi。x1=0,并且xn<=100000。第三行包含学校的坐标xu和yu,都不超过100000。
输出:
输出只有一行,输出理想的下车的车站的下标i。
样例输入:
4 5 2
0 2 4 6
4 1
样例输出:
3
样例输入:
2 1 1
0 100000
100000 100000
样例输出:
2
注释:学生是特殊群体,汽车不会开的太快。如果学生跑的比汽车快你也不必惊讶。