1621.Running Student

Time Limit: 1s Memory Limit: 256MB

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 vs as long as needed
  • a distance between two points can be calculated according to the following formula:$\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$
  • 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.

Input Format(From the terminal/stdin)

The first line contains three integer numbers: $2 \le n \le 100, 1 \le v_b,v_s \le 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 \le 10^5$. The third line contains the coordinates of the University, integers $x_u$ and $y_u$, not exceeding $10^5$ in absolute value.

Output Format(To the terminal/stdout)

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

Sample Input 1

Copy
4 5 2
0 2 4 6
4 1
 · · \n
 · · · \n
 · \n

Sample Output 1

Copy
3
 \n

Sample Input 2

Copy
2 1 1
0 100000
100000 100000
 · · \n
 ·      \n
      ·      \n

Sample Output 2

Copy
2
 \n

Hints

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.

Submit

请先 登录

© 2025 FAQs