Problem:


Score: 200 points

Problem Statement

A country decides to build a palace.

In this country, the average temperature of a point at an elevation of x meters is T-x \times 0.006 degrees Celsius.

There are N places proposed for the place. The elevation of Place i is H_i meters.

Among them, Princess Joisino orders you to select the place whose average temperature is the closest to A degrees Celsius, and build the palace there.

Print the index of the place where the palace should be built.

It is guaranteed that the solution is unique.

Constraints

1 \leq N \leq 1000

0 \leq T \leq 50

-60 \leq A \leq T

0 \leq H_i \leq 10^5

All values in input are integers.

The solution is unique.

Input

Input is given from Standard Input in the following format:

N
T A
H_1 H_2 ... H_N

Output

Print the index of the place where the palace should be built.

Sample Input 1

2
12 5
1000 2000

Sample Output 1

1

The average temperature of Place 1 is 12-1000 \times 0.006=6 degrees Celsius.

The average temperature of Place 2 is 12-2000 \times 0.006=0 degrees Celsius.

Thus, the palace should be built at Place 1.

Sample Input 2

3
21 -11
81234 94124 52141

Sample Output 2

3



Sample input:
2
12 5
1000 2000


Sample output:
1

Submission status: Runtime Error

Solution code:
N = int(input())
T, A = map(int, input.split())
H = [map(int, input.split())]

num = 0
for i in range(N):
  deff = abs(T-H[i]*0.006-A)
  if deff < abs(T-H[num]*0.006-A):
    num = i

print(num+1)

Submission status: Runtime Error

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
tem = 1000
for i in h:
  c = t-0.006*i
  d = c - a
  if d**2 < tem:
    tem = c
answer = h.index(tem) + 1
print(answer)

Submission status: Runtime Error

Solution code:
n input()
t, a = map(int,input().split())
ary=[int(x) for x in input().split()]
x = (t-a)/0.006
def getNearestValue(list, num):
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]
if __name__ == "__main__":
    print(getNearestValue(ary, x))

Submission status: Runtime Error

Solution code:
import numpy as np
def main():
  ttt = []
  n = int(input())
  e = [[int(i) for i in input().split()] for i in range(int(input()))]
  for i in range(n):
    t = e[0][0] - e[1][i]*0.006
 	tt = abs(e[0][1] - t)
    ttt.append(tt)
  print(np.argmin(ttt)+1)
main()

Submission status: Runtime Error

Solution code:
import numpy as np
def main():
  ttt = []
  n = int(input())
  e = [[int(i) for i in input().split()] for i in range(int(input()))]
  for i in range(n):
    t = e[0][0] - e[1][i]*0.006
 	tt = abs(e[0][1] - t)
    ttt.append(tt)
  print(np.argmin(ttt)+1)

Submission status: Runtime Error

Solution code:
    def htemp(t, x):
        return float(t - 0.006 * x)
     
    input()
    lt, la = [int(x) for x in input().split()]
    h_ary = [int(x) for x in input().split()]
     
    maxdiff = float('inf')
    goodpoint = 0
    for i, h in enumerate(h_ary):
        diff = abs(la - htemp(lt, h))
        if diff < maxdiff:
            maxdiff = diff
            goodpoint = i
    print(goodpoint+1)

Submission status: Runtime Error

Solution code:
N = int(input())
T, A = map(int, input.split())
H = list(map(int, input.split()))

num = 0
for i in range(N):
  deff = abs(T-H[i]*0.006-A)
  if deff < abs(T-H[num]*0.006-A):
    num = i

print(num)

Submission status: Runtime Error

Solution code:
N = int(input())
T,A = map(int,input().split())
H = [(A -T + int(x)*0.006) for x in input().split()]
h = map(abs, H)
print(h.index(min(h))+1)

Submission status: Runtime Error

Solution code:
N = int(input())
T,A = map(int,input().split())
H = [A -(T - int(x)*0.006) for x in input().split()]
h = map(abs, H)
print(h.index(min(h))+1)

Submission status: Runtime Error

Solution code:
N = input()
T, A = map(int, input.split())
H = list(map(int, input.split()))

num = 0
for i in range(0, N):
  deff = abs(T-H[i]*0.006-A)
  if deff < abs(T-H[num]*0.006-A):
    num = i

print(num)

Submission status: Runtime Error

Solution code:
i=int(input())
T, A = input().strip().split(' ')
T, A = [int(T), int(A)]
grid = []
for j in range(i):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
jj=0
array[jj][0]=abs(array[jj][0]-(A-T)/0.006)
for jj in range(1,i,1):
  array[jj][0]=abs(array[jj][0]-(A-T)/0.006)
  
  if array[jj][0]＞array[jj-1][0]
    ans=jj
print()

Submission status: Runtime Error

Solution code:
import numpy as np
N = int(input())
T,A = map(int,input().split())
H = np.array(list(map(int,input().split())))
p = np.absolute(((T-H*0.006)-A)))
print(np.argmin(p)+1)

Submission status: Runtime Error

Solution code:
n = int(input())
t, a = map(int, input().split())
t *= 1000
a *= 1000
lst = list(map(int, input().split()))
tmp = abs(t - 6 * lst[0] - a)
tmpa = 0
for i in range(1, n):
    temp = abs(t - 6 * lst[i] - a)
    if temp < tmp:
        tmp = tmp
        tmpa = i
print(tmpa + 1)
n = int(input())
t, a = map(int, input().split())
t *= 1000
a *= 1000
lst = list(map(int, input().split()))
tmp = abs(t - 6 * lst[0] - a)
tmpa = 0
for i in range(1, n):
    temp = abs(t - 6 * lst[i] - a)
    if temp < tmp:
        tmp = temp
        tmpa = i
print(tmpa + 1)

Submission status: Runtime Error

Solution code:
T, A = map(int, raw_input().split())
H_list = map(int, raw_input().split())

average_diff = sys.float_info.max
min_i = None

for i, H in enumerate(H_list):
    tempature_diff = abs(A - (T - H*0.006))
    if tempature_diff < average_diff:
        average_diff = tempature_diff
        min_i = i
print min_i + 1

Submission status: Runtime Error

Solution code:
n = int(input())
t, a = map(int, input().split())
t *= 1000
a *= 1000
lst = list(map(int, input().split()))
tmp = abs(t - 6 * lst[0] - a)
tmpa = 0
for i in range(1, n):
    if temp < tmp:
        tmp = tmp
        tmpa = i
print(tmpa + 1)

Submission status: Runtime Error

Solution code:
N=int(input())
T,A=list(map(lambda x:float(A),input().split()))
H_list = list(map(lambda x:float(A),input().split()))
diff = [abs(T-x*0.006-A) for x in H_list]
i=diff.index(min(diff))
print(i+1)

Submission status: Runtime Error

Solution code:
import pandas as pd
n = int(input())
t,a = map(int, input().split(' '))
h = pd.Series(list(map(int, input().split(' '))))
h = abs((t - h)*0.006-a)
print(int(h.index[h == h.min()].values[0]+1))

Submission status: Runtime Error

Solution code:
import pandas as pd
n = int(input())
t,a = map(int, input().split(' '))
h = pd.Series(list(map(int, input().split(' '))))
h = abs((h - t)*0.006)
print(int(h.index[h == h.min()].values[0]+1))

Submission status: Runtime Error

Solution code:
import math


N    = int(input())
T, A = map(int, input().split())
H    = list(map(int, input().split()))

D = math.inf
R = 0

for i, h in enumerate(H):
    d = A - (T - h * 0.006)
    if D > d:
        D = d
        R = i + 1

print(R)