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:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

ans = 0
min_t = float('inf')

for i in range(N):
    if abs((T - H[i] * 0.006) - A) < min_t:
        min_t = abs((T - H[i] * 0.006) - 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()))
z=10**3
ans=1001
for i in range(N):
    if abs(A-(T-H[i]*0.006))<z:
        z=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()))
h.insert(0, 0)
min_diff = float('inf')
for i in range(1, n + 1):
    temp = t - h[i] * 0.006
    if abs(a - temp) < min_diff:
        min_diff = abs(a - temp)
        ans = i
print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    ans = -1
    diff = float("inf")
    for i in range(N):
        ave_t = T - H[i] * 0.006
        if abs(ave_t - A) < diff:
            diff = abs(ave_t - 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()))

for i in range(n):
    i_temperature = t - h[i]*0.006
    dif_a = abs(a - i_temperature)
    if i == 0:
        champ = dif_a
    if champ >= dif_a:
        champ = dif_a
        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(input().split(),dtype=np.float64)
x = np.abs(t-h*0.006 -a)
ans = np.argmin(x)+1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
t, a = map(int, input().split())
h = np.array([int(i) for i in input().split()])
tp = abs(t - 0.006*h - a)
print(np.argmin(tp)+1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

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

gap = 1000000000000000000000

H = np.asarray(H)

Tem = T-H*0.006

for i in range(N):

    if abs(Tem[i]-A)<gap:
        gap = abs(Tem[i]-A)
        palace = i+1

print(palace)

Submission status: Accepted

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

t = [0 for i in range(N)]
diff = [0 for i in range(N)]

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Python3 (3.4.3)
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# function
# -------------------------------------------------------------


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

ans = -1
ans_tp = 1000
for i in range(N):
    h = H[i]
    tp = T - 0.006*h
    if abs(ans_tp-A) > abs(tp-A):
        ans_tp = tp
        ans = i

print(ans+1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = map(lambda x: abs(1000 * A - (1000 * T - int(x) * 6)), input().split())
score = float("inf")
pos = 0
for i, a in enumerate(H, 1):
    if score > a:
        score = a
        pos = i
print(pos)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
ns = lambda: stdin.readline().rstrip()
na = lambda: list(map(int, stdin.readline().split()))

# code here
N = ni()
T, A = na()
H = na()

ans = 0
min_a = 1000

for i, h in enumerate(H):
    t = T - (h * 0.006)
    a = abs(A - t)

    if min_a > a:
        min_a = a
        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()]

temp = []

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

    temp.append(t)

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

Submission status: Accepted

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

mn = None
for i in range(N):
    x = abs(A - (T - H[i] * 0.006))
    if mn is None or x < mn[1]:
        mn = (i, x)
print(mn[0] + 1)

Submission status: Accepted

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

best_err, best_place = None, None
for i, h in enumerate(H, start=1):
    t = T - 0.006 * h
    err = abs(t - A)
    if best_err is None or err < best_err:
        best_err, best_place = err, i
print(best_place)

Submission status: Accepted

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

ans = abs(T - 0.006 * H[0] - A)
sel = 1
for i in range(N):
    gap = abs(T - 0.006 * H[i] - A)
    if ans > gap:
        ans = gap
        sel = i+1
print(sel)

Submission status: Accepted

Solution code:
n = int(input())
t,a=map(int,input().split())
h = list(map(int,input().split()))
kouho = 0
min_ = 10**18
for i in range(n):
  ondosa = abs(a-t+h[i]*0.006)
  if min_ > ondosa:
    kouho = i+1
    min_ = ondosa
print(kouho)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
hl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

mn=abs(a-(t-hl[0]*0.006))
temp=[]
for i in range(n):
    mn=min(mn,abs(a-(t-hl[i]*0.006)))
    temp.append(abs(a-(t-hl[i]*0.006)))

print(temp.index(mn)+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
H = list(map(int, input().split()))
ans = -1
minv = float('inf')
for i, h in enumerate(H):
	if abs(a - (t - h*0.006)) < minv:
		minv = abs(a - (t - h*0.006))
		ans = i + 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split(' '))
places = [int(x) for x in input().split()]

base_temperature = abs(A - (T - places[-1] * 0.006))
num = N

for i in range(N - 1):
    temperature = abs(A - (T - places[i] * 0.006))
    if base_temperature > temperature:
        base_temperature = temperature
        num = i + 1

print(num)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
tl = list(map(lambda x: abs(A - (T - x * 0.006)), H))
print(tl.index(min(tl)) + 1)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
min = 10000000
j = 0
pos = 0

for i in H:
  j += 1
  if abs(A - (T - 0.006 * i)) < min:
    min = abs(A - (T - 0.006 * i))
    pos = j
print(pos)

Submission status: Accepted

Solution code:
N=int(input())
T,A = map(int, input().split(' '))
places=[int(x) for x in input().split()]

diff = abs( A - T - places[-1]*0.006)
num = N

for i in range(N-1):
  temperature = abs( A - (T - places[i]*0.006))
  if diff > temperature:
    diff = temperature
    num=i+1

print(num)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

check = []
append = check.append
for i, h in enumerate(H):
    append(
        {
            "index": i + 1,
            "temp": T - h * 0.006
        }
    )
check.sort(key=lambda x: abs(A - x["temp"]))

print(check[0]["index"])

Submission status: Accepted

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

Submission status: Accepted

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


# sol 1
#lst = list(map(int, input().split()))
#print(max(lst) - min(lst))

IDX = -1
DIFF = 10000
for idx, height in enumerate(h):
    diff = abs(t - 0.006 * height - a)
    if diff < DIFF:
        DIFF = diff
        IDX = idx
print(IDX + 1)

Submission status: Accepted

Solution code:
INF = 10 ** 6

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

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

print(ans)

Submission status: Accepted

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

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

x = []

for i in range(0,n):
  tmp = t - h[i]*0.006
  x.append(abs(a-tmp))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int, input().split())
l = list(map(int, input().split()))
al = [0]*n

for i in range(n):
  temp = t
  temp = temp - 0.006 * l[i]
  al[i] = abs(temp - a)

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

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(lambda x: abs(T - int(x)*0.006 - A), input().split()))
sort_H = sorted(H, reverse=False)
print(H.index(sort_H[0]) + 1)

Submission status: Accepted

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

ans = 999999999999999999999

for i in range(N):
    Average = T - H[i] * 0.006
    d = abs(A - Average)
    if d < ans:
        ans = d
        num = i + 1
print(num)

Submission status: Accepted

Solution code:

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

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

sa = [0]*N
for i in range(N):
    sa[i] = abs(A-temp[i])

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

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
lst = []
for i in H:
    ans = abs(A - (T - i * 0.006))
    lst.append(ans)
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()))

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

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()))
L=list()
for i in H:
  l=abs(A-T+i*0.006)
  L.append(l)
print(L.index(min(L))+1)

Submission status: Accepted

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

_h = []
#t - 0.006*x

for i in range(n):
    _h.append(abs(t - 0.006*h[i] - a))

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    T, A = map(int, input().split())
    H = list(map(int, input().split()))
    cand = -1
    diff = 1000000
    for i, h in enumerate(H):
        if abs(A - (T - h * 0.006)) < diff:
            cand = i + 1
            diff = abs(A - (T - h * 0.006))
    print(cand)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
H = np.array(H)
C = list(abs(A - (T - H * 0.006)))
answer = C.index(min(C))+1

print(answer)

Submission status: Accepted

Solution code:
temp = []

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

for i in range(0,N):
  temp.append(abs(A-(T-int(H[i])*0.006))) 

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

Submission status: Accepted

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

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

ans = [None] * N
for i in range(len(H)):
  ans[i] = (abs(A - (T - H[i] * 0.006)), i)
  
ans = sorted(ans, key = lambda x:x[0])
print(ans[0][1] + 1)

Submission status: Accepted

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


def temperature(x):
    return t - x * 0.006


for i in range(n):
    c = temperature(h[i])
    if i == 0:
        d = abs(a - c)
        ans = 1
    else:
        if abs(a - c) < d:
            d = abs(a - c)
            ans = i + 1

print(ans)

Submission status: Accepted

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

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

ans_i = -1
min_h = 10 ** 6

for i in range(len(H)):
  h = T - H[i] * 0.006
  if abs(A - h) < min_h:
    min_h = abs(A - h)
    ans_i = i

print(ans_i + 1)

Submission status: Accepted

Solution code:
# For taking integer inputs.
import math


def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


n = inp()

t, a = invr()

H = inlist()
avg = []

for h in H:
    temp = t - h * 0.006
    d = abs(a-temp)
    avg.append(d)
indx = 0
for i in range(n):
    if avg[i] < avg[indx]:
        indx = i
print(indx+1)

Submission status: Accepted

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

def get_mean_of_temp(x, t):
    return t-x*0.006

temp_diff = [abs(get_mean_of_temp(h_i, t)-a) for h_i in h]

min_v = min(temp_diff)
min_i = temp_diff.index(min_v)
print(min_i+1)

Submission status: Accepted

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

Submission status: Accepted

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

min_val = 10000

for i in range(len(H)):
    tmp = T - H[i] * 0.006
    sub = abs(tmp - A)
    if min_val > sub:
        ans = i
        min_val = sub


print(ans+1)

Submission status: Accepted

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

Submission status: Accepted

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

print(min(list(map(lambda x: [abs(t - x * 0.006 - a), h.index(x)], h)), key = lambda x:x[0]).pop() + 1)

Submission status: Accepted

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

print(min([[abs(t - x * 0.006 - a), i] for i, x in enumerate(h)], key = lambda x:x[0]).pop() + 1)

Submission status: Accepted

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

diff_temp = list(map(lambda x: abs(t - x * 0.006 - a), h))
print(diff_temp.index(min(diff_temp)) + 1)

Submission status: Accepted

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

diff_temp = [abs(t - x * 0.006 - a) for x in h]
print(diff_temp.index(min(diff_temp)) + 1)

Submission status: Accepted

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

min_diff_temp = 710
out_i = 0
for i, x in enumerate(h):
    diff_temp = abs(a - (t - x * 0.006))
    if diff_temp < min_diff_temp:
        min_diff_temp = diff_temp
        out_i = i + 1

print(out_i)

Submission status: Accepted

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

min_diff_temp = 999
out_i = 0
for i, x in enumerate(h):
    diff_temp = abs(a - (t - x * 0.006))
    if diff_temp < min_diff_temp:
        min_diff_temp = diff_temp
        out_i = i + 1

print(out_i)

Submission status: Accepted

Solution code:
# B https://atcoder.jp/contests/abc113/tasks/abc113_b
N=int(input())
T,A= map(int, input().split())
Building_Heights=list(map(int,input().split()))
Buildings_Temps =list(map(lambda x:abs(A-(T-(x*0.006))),Building_Heights))
print(Buildings_Temps.index(min(Buildings_Temps))+1)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys

import fractions
import copy
import bisect
import math
import numpy as np
import itertools
from itertools import combinations_with_replacement
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


j=0
k=0
n=3
r=1
a=[0]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation



'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''

#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
import itertools
from itertools import combinations_with_replacement

combinationについて
以下の違いを意識しよう
combinations() p, r 長さrのタプル列、ソートされた順で重複なし

combinations_with_replacement() p, r 長さrのタプル列、ソートされた順で重複あり


使用例 　　　　　　　　　　　                  出力　　
combinations('ABCD', 2)　　　　　　　　　　　　AB AC AD BC BD CD

combinations_with_replacement('ABCD', 2)　　 AA AB AC AD BB BC BD CC CD DD
'''



'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''

'''
素数の判定
'''


def is_prime(n):
    if n == 1: return False

    for k in range(2, int(np.sqrt(n)) + 1):
        #sqrt(n)+1以上は考えて約数はないので却下
        if n % k == 0:
            return False
            #割り切れたらFalse
    return True


'''
npのmaxとmaximumの違い
xs = np.array([1, -2, 3])
np.max(xs, 0)
この出力は3となります．[1, -2, 3]と0の4つの数字のうち，最も大きい値を出力します．

一方で，[max(1, 0), max(-2, 0), max(3, 0)]を出力したい時があります．
その時は，numpyのmaximum関数を用います．

xs = np.array([1, -2, 3])
np.maximum(xs, 0)  # [1, 0, 3]

'''

def factorial(x, mod=10**9+7):
    # x!
    # 階乗
    # ex) factorial(5) = 120
    tmp = 1
    for i in range(1, x+1):
        tmp = (tmp * i) % mod
    return tmp
    '''
    Basically, when you do a**d % n, you actually have to calculate a**d, which could be quite large.
    But there are ways of computing a**d % n without having to compute a**d itself, and that is what pow does.
    '''


########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

'''
ascii_letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
digits = '0123456789'
hexdigits = '0123456789abcdefABCDEF'
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv...\xaf\xb0...
lowercase = 'abcdefghijklmnopqrstuvwxyz'
octdigits = '01234567'
printable = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU...
punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
whitespace = '\t\n\x0b\x0c\r '
'''
def main():
    n=3
    steps=0
    state=0
    w=1
    j=0
    k=0
    #lenを変数に置くと事故るから注意
    n=int(input())
    #t,b=input().split(" ")#a,bがともに文字列のとき
    t,a=map(int, input().split(" "))
    #mapでとってもstrで変換すればappend可能
    hl=list(map(int, input().split(" ")))#数字の時
    #s=input()
    #a=[int(i) for i in s]#int取るとstrでも行ける
    #print(a)
    #brray=[list(map(int, input().split(" ")))for i in range(N)]
    #print(brray)
    diftl=[0]*n#絶対値で考えるとええんやで
    for i in range(n):
        diftl[i]=abs(a-(t-(0.006)*hl[i]))
    print(diftl.index(min(diftl))+1)


    for i in range(1,n+1,2):#これで1個飛ばしループになる
     pass
     #print(i)

    l = ['aaa', 'bbb', 'ccc']
    x=l.index('aaa')#ある要素のインデックス番号を取得
    #s = ''.join(l)
    #s = " ".join(map(str,a))#スペースを空ける時はこう
    #print(s)
    # aaabbbccc

    #if state in known_states and not flag: # state => 2 steps => 5
        #こうやってある要素がリストの中にあるか探すのか
    #print(f'steps: {steps}, state: {state}')
    #こう書いてあるとデバックしやすい

    #dp= [[0]*3 for i in range(5)]#列　行
    #dp用の0の入ったやつ
    #dp= [[0]*(w+1) for i in range(n+1)]#0からwまでのw+1回計算するから
    #print(dp)＃初期条件が入る分計算回数+1列分必要(この場合は判断すべきものの数)
    DP = np.zeros(w+1, dtype=int)#これでも一次元リストが作れる
    exdp=np.zeros((3,4)) # ３×４の２次元配列を生成。2次元ならこう
    #dtypeは指定しないとfloatになる
    #for i in range(n):#ちょっとした入力に便利
    #    a, b = map(int, input().split())
        #dp[i][0] += [a]
        #これだとintとlistをつなぐことになって不適
    #    dp[i] += [a]
    #    dp[i] += [b]
        #これはうまくいく
        #やり方はいろいろあるということ
    #print(dp)


    #brray=[list(map(int, input().split(" ")))for i in range(N)
    #print(brray)



    '''
    入力
    1234
    出力
    [1, 2, 3, 4]
    '''
    pin_l=["x" for i in range(10)]#内包表記に慣れろ
    #print(pin_l)

    ls = ["a", "b", "c", "d", "e"]


    #print(ls[2:5])
    #スライスでの取得

    #print(ls[:-3])
    #一番左端から右から3番目より左まで取得

    #print(ls[:4:2])
    #スライスで1個飛ばしで取得
    #ないときは左端スタート
    #始点のインデックス番号 : 終点のインデックス番号 : スキップする数+1
    #print(ls[::2])
    '''
    lsというリストの場合に、1つ飛びの値を取得したい場合には
    ls[::2]
    のようにします。こうすると、
    ["a", "c", "d"]と出力される
    '''

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
newH=[1000*t-x*6 for x in H]
dif=float('inf')
ans=-1
for i in range(n):
    if abs(1000*a-newH[i])<dif:
        dif=abs(1000*a-newH[i])
        ans=i
print(ans+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
newH=[(t-x*0.006,i) for i,x in enumerate(H)]
newH=sorted(newH)
from bisect import bisect_left, bisect_right
Ht=[newH[i][0] for i in range(n)]
Hi=[newH[i][1] for i in range(n)]
i=bisect_left(Ht, a)
if i==0:
    ans=Hi[0]+1
elif i==n:
    ans=Hi[n-1]+1
else:
    if abs(a-Ht[i-1])>abs(a-Ht[i]):
        ans=Hi[i]+1
    else:
        ans=Hi[i-1]+1
print(ans)

Submission status: Accepted

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

res = 99999999
num = 0
for i in range(n):
    temp = t - h[i] * 0.006
    if res >= abs(temp - a):
        res = abs(temp - a)
        ans = i + 1

print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    l = []
    N = int(input())
    T, A = map(int, input().split())
    h = list(map(int, input().split()))
    for  i in range(N):
      l.append(abs(A-(T-h[i]*0.006)))
    print(l.index(min(l))+1)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

def main():
    ans = 0
    N = int(input())
    T, A = map(int, input().split())
    h = list(map(int, input().split()))
    temp = float('inf')
    for  i in range(N):
        d = T - h[i]*0.006
        if abs(A - temp) > abs(A - d):
            temp = d
            ans = i+1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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()]

# 小数の扱いをせずに済ますため、1000 倍する
candidate = [(abs(1000 * A - 1000 * T + 6 * h), k) for k, h in enumerate(H, 1)]
print(sorted(candidate)[0][1])

Submission status: Accepted

Solution code:
import sys
n = int(sys.stdin.readline().rstrip("\n"))
t, a = map(int, sys.stdin.readline().rstrip("\n").split())
h = [int(s) for s in sys.stdin.readline().rstrip("\n").split()]
d = abs(t - h[0] * 0.006 - a)
mini = 1
for i in range(1,len(h)) :
    d_ = abs(t - h[i] * 0.006 - a)
    if d_ < d:
        d = d_
        mini = i + 1
print(mini)