9B.md (2370B)
1 Source: https://codeforces.com/problemset/problem/9/B 2 3 B. Running Student 4 5 time limit per test 6 7 1 second 8 9 memory limit per test 10 11 64 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 And again a misfortune fell on Poor Student. He is being late for an exam. 22 23 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*. 24 25 Poor Student knows the following: 26 27 * during one run the minibus makes *n* stops, the *i*-th stop is in point (*x**i*, 0) 28 * coordinates of all the stops are different 29 * the minibus drives at a constant speed, equal to *v**b* 30 * it can be assumed the passengers get on and off the minibus at a bus stop momentarily 31 * Student can get off the minibus only at a bus stop 32 * Student will have to get off the minibus at a terminal stop, if he does not get off earlier 33 * the University, where the exam will be held, is in point (*x**u*, *y**u*) 34 * Student can run from a bus stop to the University at a constant speed *v**s* as long as needed 35 * a distance between two points can be calculated according to the following formula:  36 * Student is already on the minibus, so, he cannot get off at the first bus stop 37 38 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. 39 40 Input 41 42 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* ≤ 105. The third line contains the coordinates of the University, integers *x**u* and *y**u*, not exceeding 105 in absolute value. 43 44 Output 45 46 In the only line output the answer to the problem — index of the optimum bus stop. 47 48 Examples 49 50 Input 51 52 ``` 53 4 5 2 54 0 2 4 6 55 4 1 56 ``` 57 58 Output 59 60 ``` 61 3 62 ``` 63 64 Input 65 66 ``` 67 2 1 1 68 0 100000 69 100000 100000 70 ``` 71 72 Output 73 74 ``` 75 2 76 ``` 77 78 Note 79 80 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.