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: Accepted

Solution code:
# abc113_b.py
# https://atcoder.jp/contests/abc113/tasks/abc113_b

# B - Palace /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点: 200点

# 問題文
# ある国で、宮殿を作ることになりました。
# この国では、標高が xメートルの地点での平均気温は T−x×0.006度です。
# 宮殿を建設する地点の候補は N個あり、地点 i の標高は Hiメートルです。
# joisinoお姫様は、これらの中から平均気温が A度に最も近い地点を選んで宮殿を建設するようにあなたに命じました。
# 宮殿を建設すべき地点の番号を出力してください。
# ただし、解は一意に定まることが保証されます。

# 制約
#     1≤N≤1000
#     0≤T≤50
#     −60≤A≤T
#     0≤Hi≤105
#     入力は全て整数
#     解は一意に定まる

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# T A
# H1 H2 ... HN

# 出力
# 宮殿を建設すべき地点の番号を出力せよ。

# 入力例 1
# 2
# 12 5
# 1000 2000

# 出力例 1
# 1

#     地点 1の平均気温は 12−1000×0.006=6度です。
#     地点 2の平均気温は 12−2000×0.006=0度です。

# よって、宮殿を建設すべき地点は地点 1となります。

# 入力例 2
# 3
# 21 -11
# 81234 94124 52141

# 出力例 2
# 3


def calculation(lines):
    N = int(lines[0])
    T, A = list(map(int, lines[1].split()))
    values = list(map(int, lines[2].split()))
    # n = lines[0]

    result = None
    id = None

    for i, value in enumerate(values):
        t = T - value * 0.006
        # print(t)
        dif = abs(A-t)
        if result is None:
            result = dif
            id = i
        elif result > dif:
            result = dif
            id = i

    return [id+1]



# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['2', '12 5', '1000 2000']
        lines_export = [1]
    if pattern == 2:
        lines_input = ['3', '21 -11', '81234 94124 52141']
        lines_export = [3]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(3)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

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

for i in range(N) :
  Temp.append(T-0.006*H[i]-A)

Temp_abs=[]
for i in range(N) :
  Temp_abs.append(abs(Temp[i]))

cnt =1
for i in range(N):
  if min(Temp_abs) != Temp_abs[i]:
    cnt+=1
  else:
    print(cnt)

Submission status: Accepted

Solution code:
import numpy as np
#-------------
N = int(input())
T,A = map(int, input().split())
H =list(map(int, input().split()))
#-------------
Temp = []

for i in range(N) :
  Temp.append(T-0.006*H[i]-A)
  
Temp = np.abs(Temp)
cnt =1
for i in range(N):
  if min(Temp) != Temp[i]:
    cnt+=1
  else:
    print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
ans=0
temp=0
abs_min=10000
for i in range(n):
    temp=t-(h[i]*0.006)
    if abs(a-temp)<abs_min:
        ans=i+1
        abs_min=abs(a-temp)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())

h = list(map(int,input().split()))

temp = []
for i in h:
    temp.append(abs(a-(t-i*0.006)))
print(temp.index(min(temp))+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = input().split(' ')
T = int(T)
A = int(A)
H = input().split(' ')
H = [int(H[i]) for i in range(N)]
check = 10**9
for i in range(N):
  C = A - (T - H[i] * 0.006)
  if abs(C)<check:
    check = abs(C)
    point = i + 1
print(point)

Submission status: Accepted

Solution code:
N = int(input())
T,A=map(int,input().split())
List = list(map(int, input().split()))
t = 0
mid = 0
MID = 100000000000
res = 100000000000
for i in range(N):
  t = T - 0.006*List[i]
  mid = abs(A-t)
  if mid < MID:
    MID = mid
    res = i+1
print(res)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))

temp=[(abs((t-h[i]*0.006)-a),i+1) for i in range(n)]

print(min(temp)[1])

Submission status: Accepted

Solution code:
def calc_temp(x,T):
    return T - x * 0.006

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

near_temp = 1000

for i in range(N):
    if abs(A - calc_temp(H_list[i],T)) <= abs(A - near_temp):
        near_temp = calc_temp(H_list[i],T)
        num = i+1

print(num)

Submission status: Accepted

Solution code:
#58
import decimal
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))

near = float("inf")
num = 0

for i in h:
    x = t - i*decimal.Decimal("0.006")
    if near > abs(a-x):
        near = abs(a-x)
        num = i
        
print(h.index(num)+1)

Submission status: Accepted

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

INF = 10**5
temp = INF

for i in range(N):
  t = T - H[i]*0.006
  if abs(t-A) <= temp:
    temp = abs(t-A)
    ans = i+1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
l = []
for i in range(n):
  l.append(abs(a-(t-h[i]*6/1000)))
print(l.index(min(l))+1)

Submission status: Accepted

Solution code:
n = int(input())
x = list(map(int, input().split()))
h = list(map(int, input().split()))

t = x[0]
a = x[1]
cnt = 1000000000000000000000
ans = 0
for i in range(n):
  tmp = abs(t-(h[i]*0.006)-a)
  if cnt > tmp:
    cnt = tmp
    ans = i+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
(*h,) = map(int, input().split())
x = (t - a) * 1000 // 6
h_min = 10 ** 5
for i in range(n):
    if abs(h[i] - x) < h_min:
        h_min = abs(h[i] - x)
        ans = i
print(ans + 1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int , input().split())
hn = [int(num) for num in input().split()]

answers = []
for h in hn:
  answers.append(abs(a-(t-h*0.006)))
  
print(answers.index(min(answers))+1)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

ans = 1
pre = abs(a * 1000 - (t * 1000 - h[0] * 6))
for i in range(1, n):
    tmp = (t * 1000 - h[i] * 6)
    tmp = abs(a * 1000 - tmp)
    if tmp < pre:
        pre = tmp
        ans = i + 1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

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

temperatures = list(abs([T]*N - H*0.006 - [A]*N))

print(temperatures.index(min(temperatures))+1)

Submission status: Accepted

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

lst = []
for i in range(N):
	ref = abs(A-(T-0.006*H[i]))
	lst.append(ref)

ans = lst.index(min(lst))+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
lists = list(map(int, input().split()))

tmp_lists = [(t - i*0.006) for i in lists]
diff_lists = []
for i in tmp_lists:
  diff_lists.append(a-i if (a-i) >=0 else (a-i)* -1)
copy = diff_lists.copy()
copy.sort()
index = diff_lists.index(copy[0])
print(index+1)

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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

    d = 10000000
    ans = 0
    for i, h in enumerate(H):
        if abs(T - 0.006*h - A) < d:
            d = abs(T - 0.006*h - A)
            ans = i+1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
num = abs(A - T + H[0]*0.006)
ans = 1
for i in range(1,N):
    if num > abs(A-T+H[i]*0.006):
        num = abs(A-T+H[i]*0.006)
        ans = i+1
print(ans)

Submission status: Accepted

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

diff = [abs(A-(T-H[i]*0.006)) for i in range(N)]
#print(min(diff))
print(diff.index(min(diff))+1)

Submission status: Accepted

Solution code:
# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
N = int(input())
T,A = (int(i) for i in input().split())
H = list(map(int, input().split()))


#Hi mの気温
#T_H =[-100]*N
dif =[100]*N
for i in range(N):
    T_H =T -H[i] *0.006
    dif[i] =abs(T_H -A)

ans =dif.index(min(dif)) #最小値のインデックス
print(ans +1)

Submission status: Accepted

Solution code:
import math
def main():
  n=int(input())
  t,a = list(map(int,input().split()))
  h = list(map(int,input().split()))
  ans = abs(a-(t-h[0]*0.006))
  ansid=0
  for i in range(1,n):
    if abs(a-(t-h[i]*0.006)) < ans :
      ans=abs(a-(t-h[i]*0.006))
      ansid=i
  print(ansid+1)
main()

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
mi = 1000000000
for i in range(n):
    if mi > abs(a-(t-h[i]*0.006)):
        mi = abs(a-(t-h[i]*0.006))
        ans = i+1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T,A = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
m = -float("inf")
p = -1
for i,h in enumerate(H,1):
    t = T - (h * 6 / 1000)
    if abs(A - t) < abs(A - m):
        m = t
        p = i
print(p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
num=0
for i in range(N):
    if i==0:
        num=(T-H[0]*0.006)
        spot=0
    else:
        if abs(A-(T-H[i]*0.006))<=abs(A-num):
            num=(T-H[i]*0.006)
            spot=i

print(spot+1)

Submission status: Accepted

Solution code:
from fractions import Fraction
N,T,A,*HH = map(Fraction, open(0).read().split())
print(int(min(enumerate(HH), key=lambda x:abs(T-x[1]*Fraction('0.006')-A))[0]+1))

Submission status: Accepted

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

for n in range(N):
  C = T-H[n]*0.006
  if dif > abs(A-C):
    dif = abs(A-C)
    num = n+1
    
print(num)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int,input().split()))
temp = [0] * n
def func(x) :
    return abs(x-a)
for i in range(n) :
    temp[i] = t - h[i] * 0.006
diff = list(map(func, temp))
mn_index = diff.index(min(diff))
print(mn_index+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
X = 10 ** 5 + 1
ans = 0
for i in range(N):
    t = T - H[i] * 0.006
    if abs(t - A) <= X:
        ans = i + 1
        X = abs(t - A)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
temp = [abs(T-h*0.006 - A) for h in H]
ans = 0
mint = 10**20
for i, t in enumerate(temp):
  if mint > t:
    mint = t
    ans = i+1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
H_temp = [None] * len(H)

for i in range(len(H)):
    H_temp[i] = (abs((T - 0.006 * H[i]) - A), i+1)

H_temp.sort()
print(int(H_temp[0][1]))

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split(" "))
h = list(map(int, input().split(" ")))
avg_list = []
res = 0
for i in range(0, n):
    avg = t - h[i] * 0.006 - a
    if avg < 0:
        avg = -avg
    avg_list.append(avg)
print(avg_list.index(min(avg_list)) + 1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
near_A = 1e8
for i, H in enumerate(map(int, input().split())):
  ave_tem = T - H * 0.006
  if near_A > abs(ave_tem - A):
    near_A = abs(ave_tem - A)
    res = i + 1
print(res)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
ans=[]
for h in H:
    ans.append(abs(a-(t-h*0.006)))
print(ans.index(min(ans))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

diff_min = float('inf')
for i in range(n):
    diff = abs(a - (t - h[i] * 0.006))
    if diff < diff_min:
        ans = i + 1
        diff_min = diff
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
res = 10 ** 6
idx = 0
for i, h in enumerate(H):
    tmp = abs(A - T + h * 0.006)
    if tmp < res:
        res = tmp
        idx = i + 1
print(idx)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

val = abs(a - t + h[0] * 0.006)
ans = 1

for i in range(1, n):
    avg = abs(a - t + h[i] * 0.006)
    if avg < val:
        val = avg
        ans = i + 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

diff = [0] * n
for i in range(n):
    diff[i] = abs(a - (t - (h[i] * 0.006)))

print(diff.index(min(diff)) + 1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
ans = 10**6
te = 0
I = int()
for i in range(N):
    te = T-H[i]*0.006
    if abs(A-te) < ans:
        ans = abs(A-te)
        I = i
print(I+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = list(map(int, input().split()))
H = list(map(int, input().split()))
t = 1_000_000
res = 0
for i in range(N):
    _t = abs(A - (T - H[i] * 0.006))
    if _t < t:
        res = i
        t = _t
print(res + 1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
d = {}
for x in H:
    d[x] = abs(A-(T-x*0.006))
counter = 1
counter_x = 1
min_ = 100000
for i in d.values():
    if(min_>=i):
        min_ = i
        counter_x = counter
    counter += 1
print(counter_x)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
H = list(map(int, input().split()))
ans = []
for i in range(n):
    average_tmp = t - H[i] * 0.006
    diff = abs(a - average_tmp)
    ans.append(diff)
print(ans.index(min(ans)) + 1)

Submission status: Accepted

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

min = max(array_hight)
point = ''
for I in array_hight:
    if abs(A - (T - (I * 0.006))) < min:
        min = abs(A - (T - (I * 0.006)))
        point = array_hight.index(I)
print(int(point)+1)

Submission status: Accepted

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

def TEMP(H):
    return T - H*0.006

def AAA(H):
    return abs(A - H)

H = list(map(TEMP, H))

H = list(map(AAA, H))

print(H.index(min(H))+1)

Submission status: Accepted

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

def getTemperature(H):
  return T - H * 0.006

def adjustAbs(H):
  if H > A:
    return abs(H - A)
  else:
    return abs(A - H)

H = list(map(getTemperature, H))

H = list(map(adjustAbs, H))

print(H.index(min(H))+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
lst = []
for i in range(N):
    tmp = abs(A-(T - H[i] * 0.006))
    lst.append(tmp)

print(lst.index(min(lst))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

inf = float('inf')
closest = inf
closest_i = inf
for i, v in enumerate(h):
    if abs(a - (t - 0.006*v)) < closest:
        closest = abs(a - (t - 0.006*v))
        closest_i = i + 1
print(closest_i)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, t, a, *h = map(int, open(0).read().split())
x = (t - a) * 1000 / 6
h = [abs(x - i) for i in h]
print(h.index(min(h)) + 1)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

H = list(map(int, input().split()))

Th = [T-H[i]*0.006 for i in range(N)]
Td = [abs(Th[i]-A) for i in range(N)]
print(Td.index(min(Td))+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=[int(i) for i in input().split()]

h_list=[int(i) for i in input().split()]

#絶対値のリスト
abs_list=[]
for i in range(n):
    abs_list.append(abs(a-(t-h_list[i]*0.006)))
    
print(abs_list.index(min(abs_list))+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

o = (t-a)/0.006 
l = [abs(i-o) for i in h]
ans = l.index(min(l)) + 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int, input().split())
dat = list(map(int, input().split()))
resind = -1
resval = 9999999999999999999999999
for i in range(n):
    x = t - dat[i] * 0.006
    diff = abs(x-a)
    if diff < resval:
        resval = diff
        resind = i
print(resind+1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))

ans = 99999999
ansplace = 0
for cnt, i in enumerate(h):
	if ans > abs(t-i*0.006-a):
		ans = abs(t-i*0.006-a)
		ansplace = cnt
print(ansplace+1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
now = 10000000
ans = 0
H = list(map(int,input().split()))
for i in range(N):
    tmp = T - H[i]*0.006
    if abs(A - tmp) < now:
        now = abs(A - tmp)
        ans = i+1
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
t, a = rm()
ansv = inf
ansi = 0
for i, v in enumerate(rl()):
  if abs(a-t+v*0.006) < ansv:
    ansv = abs(a-t+v*0.006)
    ansi = i+1
print(ansi)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
d_min = 99999
ans = 0
for i in range(n):
    d = abs(t - a - h[i] * 0.006)
    if d < d_min:
        d_min = d
        ans = i + 1
print(ans)

Submission status: Accepted

Solution code:

n = int(raw_input())
t,a = map(int, raw_input().split(' '))
his = map(int, raw_input().split(' '))
m = (+float('inf'),-1)
for i,hi in enumerate(his): m = min(m, (abs(t - hi * 0.006 - a),i+1))
print  m[1]

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
m = 1 
mindis = abs(A-(T-H[0]*0.006))
for i in range(1,N):
  cd = abs(A-(T-H[i]*0.006))
  if mindis > cd:
    m = i+1
    mindis = cd
print(m)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
m = 1 
mindis = abs(A-(T-H[0]*0.006))
for i in range(1,N):
  cd = abs(A-(T-H[i]*0.006))
  if mindis > cd:
    m = i+1
    mindis = cd
print(m)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))

ans = 0
s = float("inf")
for i in range(n):
  if abs(a - (t-h[i]*0.006)) < s:
    s = abs(a - (t-h[i]*0.006))
    ans = i+1
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
t,a = map(int,input().split())
h = list(map(int, input().split()))

ans = 0
ansc = 999999

for i in range(len(h)):
    c = abs(a - (t - h[i] * 0.006))
    if c < ansc:
        ansc = c
        ans = i + 1

print(ans)

Submission status: Accepted

Solution code:
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
t,a = i2()
h = intl()

ans = 0
min = 10000
for i in range(n):
	if abs(t - 0.006*h[i] - a) < min:
		min = abs(t - 0.006*h[i] - a)
		ans = i+1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int,input().split())
H = list(map(int,input().split()))
best = 1000.0
point = 0
ans = 0
for i in range(N):
    ans = abs(A - (T - H[i]*0.006))
    if best > ans:
        best = ans
        point = i + 1
print(point)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
minn=10**10
for i in range(n):
  if minn>abs((t*(1000)-6*H[i])-a*1000):
    ans = i
    minn=abs((t*(1000)-6*H[i])-a*1000)
print(ans+1)

Submission status: Accepted

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

ans = 1
tmpr_distA = abs(A - (T -0.006*H[0]))
for i in range(1,N,1):
    tmptmpr = abs(A - (T-0.006*H[i]))
    if tmptmpr < tmpr_distA:
        tmpr_distA = tmptmpr
        ans = i+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
H = list(map(int, input().split()))
mtd = 1000
for i in range(n):
    if abs(a - (t - (H[i] * 0.006))) < mtd:
        mtd = abs(a - (t - (H[i] * 0.006)))
        ans = i + 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
ans=0;m=100000000
A=A*1000;T=T*1000
for i in range(N):
    if abs(A-(T-(H[i]*6))) < m:m=abs(A-(T-(H[i]*6)));ans=i+1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
o = 1000000
for i in range(n):
    if abs(a - (t - h[i] * 0.006)) < o:
        o = abs(a - (t - h[i] * 0.006))
        ans = i+1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


M=10**10
X=0
for i in range(1,N+1):
    B=abs(1000*(T-A)-6*H[i])
    if B<=M:
        M=B
        X=i
print(X)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
idx=0
m=1000000000
for i in range(n):
    tmp=t-(h[i]*0.006)
    if abs(a-tmp)<m:
        idx=i
        m=abs(a-tmp)
print(idx+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=[int(i) for i in input().split()]
h_list=[int(i) for i in input().split()]


a_list=[abs(a-(t-i*0.006)) for i in h_list]

print(a_list.index(min(a_list))+1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = list(map(int,input().split()))
H = list(map(int,input().split()))
MinDif = 1000
for i in range(N):
  Temp = T - H[i] * 0.006
  if abs(Temp - A) == min( MinDif, abs(Temp - A) ):
    MinDif = abs(Temp - A)
    ans = i + 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T,A=map(int,input().split())
H = list(map(int,input().split()))
goodi = 0
for i in range(1,N):
    if abs(A - (T - H[goodi]*0.006)) >  abs(A - (T - H[i]*0.006)):
        goodi = i
print(goodi+1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))

dic = []
for i in h:
  b = abs(a - (t - i * 0.006))
  dic.append(b)

print(dic.index(min(dic)) + 1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
z=[abs(t-x*0.006-a) for x in h]
print(z.index(min(z))+1)

Submission status: Accepted

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

ans = 0
best = 10**7
for i in range(N):
  temp = T - 0.006*H[i]
  if abs(temp - A) < best:
    best = abs(temp - A)
    ans = i+1
    
print(ans)

Submission status: Accepted

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

ans = []
for h in H:
    ans.append(abs((T-h*0.006)-A))

print(ans.index(min(ans))+1)

Submission status: Accepted

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

for i in range(N):
    H[i] = abs(A - (T - H[i]*0.006))

print(H.index(min(H))+1)

Submission status: Accepted

Solution code:
import numpy as np

def getNearestValue(list, num):
    """
    概要: リストからある値に最も近い値を返却する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx


n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))

temp = []

for i in range(n):
    temp_var = t - h[i] * 0.006
    temp.append(temp_var)

print(getNearestValue(temp,a) + 1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int, input().split())
h = list(map(int, input().split()))

ans = 1000000
cnt = 0
T = [0 for i in range(n)]

for i in range(n) :
    T[i] = t - h[i]*0.006
    q = abs(a - T[i]) 
    if (q < ans) :
        ans = q
        cnt = i+1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

diff_list = []
for h in H:
    diff = abs(A - (T - h * 0.006))
    diff_list.append(diff)

print(diff_list.index(min(diff_list)) + 1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
b,c=map(int,input().split())
d=list(map(int,input().split()))
result=[]
for i in d:
    result.append(b-i*0.006)
result2=[]
for i in result:
    result2.append(abs(c-i))
print(1+result2.index(min(result2)))

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=[int(i) for i in input().split()]
ans=10**10

for i in range(n):
    p=abs(a-(t-h[i]*0.006))
    if p<ans:
        ans=p
        ansnum=i+1

print(ansnum)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
t, a = map(float, input().split())
h = np.array([float(x) for x in input().split()])

dif = np.abs(a - (t - 0.006 * h))
print(np.argmin(dif) + 1)

Submission status: Accepted

Solution code:
def main():
    n=int(input())
    t,a=map(int,input().split())
    h=map(int,input().split())
    temp=[t-x*0.006 for x in h]
    m = (-1, 10**3)
    for i,v in enumerate(temp):
        d = abs(a-v)
        if m[1] >= d:
            m = (i, d)
    print(m[0]+1)
        
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = INT()
T, A = MI()
H = list(map(lambda x : T - 0.006 * int(x), input().split()))

for i in range(N):
    H[i] = abs(H[i] - A)
    
ans = H.index(min(H)) + 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
listh = list(map(int, input().split()))
diff = [abs((t-x*0.006)-a) for x in listh]
print(diff.index(min(diff))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
listh = list(map(int, input().split()))
temp = 100000
index = 0

for i in range(n):
    diff = abs((t - listh[i] * 0.006)-a)
    if temp > diff:
        temp = diff
        index = i+1

print(index)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
listh = list(map(int, input().split()))
temp = 100000
index = 0

for i in range(n):
    c = t - listh[i] * 0.006
    diff = abs(c-a)
    if temp > diff:
        temp = diff
        index = i+1

print(index)

Submission status: Accepted

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

temp = []

for i in range(len(H)):
  temp.append(abs((T - H[i] * 0.006) - A))
  
print(temp.index(min(temp)) + 1)