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 = []
for i, j in enumerate(input().split()):
    h.append((i+1, abs(t-int(j)*0.006-a)))
h.sort(key=lambda x:x[1])
print(h[0][0])

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
mi = 10**9
for ind, i in enumerate(h):
    tmp = abs(t-i*0.006-a)
    if tmp<mi:
        mi = tmp
        ans = ind+1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    T, A = list(map(int,_in[1].split(' ')))  # type:list(int)
    H_arr = list(map(int,_in[2].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    x = (T-A)/0.006
    diff = [abs(h-x) for h in H_arr]
    cnt = diff.index(min(diff))+1
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Accepted

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

lt = list()
for i in range(N):
    lt.append(abs(A - (T - lh[i]*0.006)))

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

# it took 6mins

Submission status: Accepted

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

Temp=[]
for index in range(N):
    func=abs(A-(T-0.006*H[index]))
    func1=[func,index]
    Temp.append(func1)

Temp.sort()
    
    
print(Temp[0][1]+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
*h, = map(int, input().split())
calc_diff = lambda x: abs(a - (t - x * 0.006))
*hdif, = map(calc_diff, h)
ans = hdif.index(min(hdif)) + 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = [abs(A-(T-float(h)*0.006)) for h in 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()))
ans=[]
for i in range(n):
    ans.append([abs(a-(t-0.006*h[i])),i+1])
ans.sort()
print(ans[0][1])

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)
print(np.argmin(abs((t - h*0.006) - a))+1)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
t, a = map(int,input().split())
h_ = list(map(int,input().split()))
b = []
for h in h_:
    b.append(abs(a - (t - 0.006 * h))) 

print(np.argmin(b)+1)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
cand = [abs(T-0.006*h-A) for h in H]
print(np.argmin(cand)+1)

Submission status: Accepted

Solution code:
import numpy as np
import sys
import math

n=int(input())
t,a=map(int,input().split())
H=list(map(int,input().split()))
H=np.array(H)
T=t-H*0.006
T=abs(T-a)
print(np.argmin(T)+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

n=I()
t,a=MI()
hs=LI()
u=[]
mini=inf
for i in range(n):
    k=abs(t-a-hs[i]*0.006)
    if k<mini:
        mini=k
        num=i
        
print(num+1)

Submission status: Accepted

Solution code:
N = int(input())
T,A = map(int, input().split())
H = list(map(int, input().split()))
judge = abs(A - (T - 0.006*H[0]))
k = 0

for i in range(N):
  a = abs(A - (T - 0.006*H[i]))
  if judge > a:
    judge = a
    k = i
    
print(k+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import numpy as np
n = int(input()) 
t, a = map(int, input().split())
h = list(map(int, input().split()))
a_t = []
for i in h:
    a_t.append(t - i * 0.006)
print(np.abs(np.asarray(a_t) - a).argmin() + 1)

Submission status: Accepted

Solution code:
import sys
inf = 10**15
mod = 10**9+7
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
bi = []
bii = []
for i in range(n):
    bi.append(t-h[i]*0.006)
    bii.append([t-h[i]*0.006, i+1])
bi.sort()
import bisect
ind = bisect.bisect_left(bi, a)
tmp = 0
if ind == n:
    tmp = bi[n-1]
else:
    if abs(bi[ind]-a) > abs(bi[ind-1]-a):
        tmp = bi[ind-1]
    else:
        tmp = bi[ind]
for i in range(n):
    if tmp == bii[i][0]:
        print(bii[i][1])
        sys.exit()

Submission status: Accepted

Solution code:
#複数の整数入力を受け付ける関数
def datain(num):

    data = []
    iscnt = True

    while iscnt:
        for val in map(int,input().split()):
            data.append(val)
            if len(data) == num:
                iscnt = False
                break
        
    return data

data = datain(int(input())+2)

minval = 1000000
ans = 0
temp = [abs(data[1]-(data[0]-0.006*temp)) for temp in data[2:]]
#print(temp)

for i,val in enumerate(temp):
    if minval > val:
        minval = val
        ans = i

print(ans+1)

Submission status: Accepted

Solution code:
N=int(input())
a=input().split()
T=int(a[0])
A=int(a[1])
H=[int(x) for x in input().split()]
t=abs(T-0.006*H[0]-A)
s=0
for i in range(N):
    if t>abs(T-0.006*H[i]-A):
        t=abs(T-0.006*H[i]-A)
        s=i
        

print(s+1)

Submission status: Accepted

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

sa=1000
for i in range(0,n):
  sasa=abs(a-(t-0.006*h[i]))
  if sasa<sa:
    sa=sasa
    keep=i
print(keep+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
tmp = float('inf')
ans = 0
for i in range(n):
    if tmp > abs(a - (t-h[i]*0.006)):
        tmp = abs(a- (t-h[i]*0.006))
        ans = i

print(ans+1)

Submission status: Accepted

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

tmp=10**10
num=0
for i in range(n):
    if abs(a-(t-l[i]*0.006)) < tmp:
        num=i+1
        tmp=abs(a-(t-l[i]*0.006))
    else:
        continue

print(num)

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()))
for i in range(n):
    H[i]=abs(t-H[i]*0.006-a)
L=list(enumerate(H,start=1))
L=sorted(L,key=lambda x:x[1])
print(L[0][0])

Submission status: Accepted

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

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

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

Submission status: Accepted

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

def get_dif(h):
    temp = t - h * 0.006
    dif = abs(temp - a)
    return dif

result = hn.index(min(hn, key=get_dif)) + 1
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
tmp = 100000

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    # 整数 1 つ
    N = int(input())
    # 整数複数個
    T, A = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    H = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    # A = [list(map(int, input().split())) for i in range(H)]

    min_sub=100000
    min_ind=0
    for i in range(N):
        t = abs((T - H[i] * 0.006) - A)
        if t < min_sub:
            min_sub = t
            min_ind = i+1

    print(min_ind)



resolve()

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
ans=0
t=10**18
for i,h in enumerate(H):
  x=T-h*0.006
  if abs(x-A)<t:
    t=abs(x-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()))
dif=abs(t-0.006*h[0]-a)
ans=1
for i in range(1,n):
    if abs(t-0.006*h[i]-a)<dif:
        ans=i+1
        dif=abs(t-0.006*h[i]-a)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
max = float("inf")
idx =1
s = 1
for i in h:
  if abs(t-i*0.006-a) < max:
    max = abs(t-i*0.006-a) 
    idx = s
  s += 1
print(idx)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
ans = 100000
d = 100000
for i in range(n):
    tem = t-h[i]*0.006
    if d >= abs(tem-a):
        d = min(d, abs(tem-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()))

temperature = 0

for a in range(0, N):
    temperature = T - h[a] * 0.006
    h[a] = abs(temperature - 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()))

T = [t-0.006*i for i in h]

ans = [abs(a-i) for i in T]

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

tmp = T - H[0] * 0.006
ans = 1

for i in range(len(H)):
    
    if abs(tmp - A) > abs(T-H[i] * 0.006 - A):
        tmp = 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()))
Tmp = [T-H[i]*0.006 for i in range(N)]

D = 999
ind = 999
for i in range(N):
  if abs(A-Tmp[i]) < D:
    D = abs(A-Tmp[i]) 
    ind = i

print(ind+1)

Submission status: Accepted

Solution code:

from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations
import sys
import bisect
import string
import math
import time
#import random


def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()

def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)

YN = ['Yes', 'No']
MOD = 10**9+7
inf = float('inf')
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)


show_flg = False
# show_flg = True

def main():
    N = I()
    T, A = MI()
    H = LI()
    TMP = []

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

    mn = 10**19
    ans = 0
    for i in range(N):
        if mn > abs(TMP[i] - A):
            mn = abs(TMP[i] - A)
            ans = i

    print(ans + 1)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
H = list(map(int,input().split()))
minitemp = 10*100
for i in range(len(H)):
  H[i] = abs(a-(t-H[i]*0.006))
  minitemp = min(minitemp,H[i])
for j in range(len(H)):
  if H[j] == minitemp:
    print(j+1)
    break

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
T, A = lr()
H = np.array(lr())
temp = np.abs(T - H * 0.006 - A)
answer = np.argsort(temp)
print(answer[0]+1)

Submission status: Accepted

Solution code:
option = int(input())
ref_t, tmp_id = (int(n) for n in input().split())
height = list((int(n) for n in input().split()))

ave_t = []
for i in range(option):
  ave_t.append(abs(tmp_id - (ref_t - height[i] * 0.006)))

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

Submission status: Accepted

Solution code:
n = int(input())    
t,a = map(int,input().split())
A =  list(map(int,input().split()))
B = [abs(t - A[i]*0.006 -a) for i in range(n)]
print(min(enumerate(B), key = lambda x:x[1])[0] +1 )

Submission status: Accepted

Solution code:
def deg(x):
    return t - x * 0.006


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

tmp = 1001001001
ans = 1
for i in range(len(h)):
    d = deg(h[i])
    if abs(a - d) < tmp:
        ans = i + 1
        tmp = abs(a - d)
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int, input().split())
list=list(map(int, input().split()))
l_b=[]
d=0
for i in range(N):
  d=A-(T-list[i]*0.006)
  if d<0:
    d=-d
  l_b.append(d)
print(l_b.index(min(l_b))+1)

Submission status: Accepted

Solution code:
'''
標高がxメートルの地点での平均気温はT−x×0.006度です。
宮殿を建設する地点の候補はN個あり、地点iの標高はHiメートルです。
平均気温がA度に最も近い地点を選んで宮殿を建設。
宮殿を建設すべき地点の番号を出力してください。
'''

n=int(input())
t,a=map(int,input().split())
h=[t-int(i)*0.006 for i in input().split()]
ans=[-1,1000000000]#地点番号と標高のリスト（初期値）
for i in range(n):
    if abs(h[i]-a)<abs(ans[1]-a):#ans[1]は標高
        ans=[i,h[i]]#地点番号と標高を洗い替え
print(ans[0]+1)#地点番号を出力（1-indexのため、+1）

Submission status: Accepted

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

ans = 100000000
index = 0

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

    if abs(A-temp)<ans:
        ans = abs(A-temp)
        index = i


print(index+1)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
T, A = MAP()
H = LIST()

a = abs(T - H[0]*0.006 - A)
ans = 1

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

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()]
sub = [0 for i in range(N)]
for i in range(N):
    sub[i] = abs(A - (T - 0.006*H[i]))
print(sub.index(min(sub))+1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
m = abs(a-(t-h[0]*0.006))
ans = 0

for i in range(1, n):
    num = abs(a-(t-h[i]*0.006))
    if num < m:
        ans = i
        m = num

print(ans+1)

Submission status: Accepted

Solution code:
import numpy as np
N = input()
T, A = map(int, input().split())
H = np.array(input().split(), dtype=np.float64)
X = abs(T - H * 0.006 - A)
print(np.argmin(X) + 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] = T - H[i]*0.006

t = 10**5
p = 0
for i in range(N):
    if abs(H[i]-A) < t:
        t = abs(H[i]-A)
        p = i+1
print(p)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
from collections import Counter
readline = sys.stdin.buffer.readline
MOD = 10**9+7
INF = float('inf')

def main():
    N = int(readline())
    T, A = map(int, readline().split())
    H = list(map(int, readline().split()))
    small = INF
    for i in range(N):
        t = T - H[i]*0.006
        if abs(A-t)<small:
            ans = i + 1
            small = abs(A-t)
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
t,a=list(map(int,input().split()))
H=list(map(int,input().split()))
A=[0]*n
for i in range(n):
  A[i]=abs(t-H[i]*0.006-a)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())
[T, A] = list(map(int, stdin.readline().rstrip().split()))
H = list(map(int, stdin.readline().rstrip().split()))



def temp(t, height):
    return t - height * 0.006

def difference(a, t):
    return max(a, t) - min(a, t)

nearest_point = 0
nearest_diff = 1000000

for i in range(N):
    t = temp(T, H[i])
    diff = difference(A, t)

    if nearest_diff > diff:
        nearest_point = i
        nearest_diff = diff

print(nearest_point+1)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    t,a = map(int, input().split())
    h = list(map(int, input().split()))
    res = 0
    most = 10000000000
    for i in range(n):
        if most>abs(a-(t-h[i]*0.006)):
            most = abs(a-(t-h[i]*0.006))
            res = i+1
    print(res)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


# 地点の平均気温を計算しListHに格納
for i in range(N):
    H[i] = T - (abs(H[i]) * 0.006)

# 目的の平均気温との差をListHに格納
for k in range(N):
    H[k] = abs(H[k] - (A))

# 差が最も小さいもののリスト番号に1を足して出力
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()))
d = [abs(T-0.006*i-A) for i in H]
print(d.index(min(d))+1)

Submission status: Accepted

Solution code:
input()
T,A = map(int,input().split())
a = list(map(int,input().split()))
#最小値
min_val = 100000
min_num=0
for i in range(len(a)):
    d = abs(T-0.006*a[i]-A)
    if d < min_val:
        min_val = d
        min_num = i
print(min_num+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def solve():
    N = int(input())
    T, A = map(int, input().split())
    Hlist = list(map(int, input().split()))

    templist = []

    for i in range(N):
        templist.append(abs((T-Hlist[i]*0.006)-A))

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


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:

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

x = 100000
ans = 0

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

print(ans+1)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

temperture_li = [abs(a-(t-h_inputs[i]*0.006)) for i in range(n)]
ans = temperture_li.index(min(temperture_li))

print(ans+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
palace = []
for i in range(1, n+1):
    candidate =[]
    temperature =abs(a -(t - h[i-1] *0.006))
    candidate.append(temperature)
    candidate.append(i)
    palace.append(candidate)
sort_palace = sorted(palace)
print(sort_palace[0][1])

Submission status: Accepted

Solution code:
# from math import factorial,sqrt,ceil,gcd
# from itertools import permutations as permus
# from collections import deque,Counter
# import re
# from functools import lru_cache # 簡単メモ化 @lru_cache(maxsize=1000)
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import networkx as nx
# from scipy.sparse.csgraph import shortest_path, dijkstra, floyd_warshall, bellman_ford, johnson
# from scipy.sparse import csr_matrix
# from scipy.special import comb

# slist = "abcdefghijklmnopqrstuvwxyz"
N = int(input())
T,A = map(int,input().split())
arrH = np.array(input().split(),dtype=np.float64)

arrH = abs((arrH*-0.006 + T)-A)
ans = np.argmin(arrH)+1
print(ans)
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する
# print("{:.10f}".format(ans))
# print("{:0=10d}".format(ans))

Submission status: Accepted

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

mtd=float('inf')
ans=0

for i in range(n):
  td = abs(t-h[i]*0.006-a)
  if td<mtd:
    mtd=td
    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()]

t_list = []

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

max = 0
for i in range(N):
    if abs(A-t_list[max]) > abs(A-t_list[i]):
        max = i
        
print(max+1)

Submission status: Accepted

Solution code:
n = int(input()) # 入力が1つ
t, a = map(int, input().split()) # 入力が複数
h = [int(i) for i in input().split()] # 配列で数字

ans = 0
nearest = abs(t - h[0] * 0.006 - a)
for i in range(n):
    temp = abs(t - h[i] * 0.006 - a)
    if temp < nearest:
        nearest = temp
        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())) 

temperature = [abs(a - (t-i*0.006)) for i in h]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
T, A = list(map(int,input().split()))
hlist1 = list(map(int,input().split()))
kion_min = 10000000
titen = -10

for i in range(N):
  kion1 = abs(T-0.006*hlist1[i]-A)
  if kion1 < kion_min:
    kion_min = kion1
    titen = i+1

print(titen)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
minv = abs(A - H[0] * 0.006)
ans = 1
for i in range(N):
    a = abs(A-(T-H[i]*0.006))
    if minv > a:
        minv = 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()))

h = list(map(lambda x: abs(a-(t-x*0.006)), h))

min_temp = 10000000
ans = -1
for i in range(n):
    if min_temp > h[i]:
        min_temp = h[i]
        ans = i+1

print(ans)

Submission status: Accepted

Solution code:
## coding: UTF-8
from decimal import *
from itertools import permutations, combinations,combinations_with_replacement,product
import math


N = int(input())
s = input().split()
p = [int(w) for w in s]
T = p[0]
A = p[1]

t = input().split()
H = [int(w) for w in t]
min_diff = 10000
index = -1
for i in range(N):
    difference = abs(  (T - H[i] * 0.006)     - A)
    if(difference < min_diff):
        min_diff = difference
        index = i

print(index+1)

Submission status: Accepted

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

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

for i in range(n):
    if abs(t-h[i]*0.006 - a) < min:
        min = 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()))
sub = 999
ans = 0
l = []
for i in range(n):
    l.append(abs(t - h[i] * 0.006 - a))
    if sub >= l[i]:
        sub = l[i]
        ans = i + 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
 
 # 平均気温aを計算する
	m=float(H[i])
	a=T-0.006*m
	if abs(A-a)<x:
		x=abs(A-a)
		y=i+1
	#print(a)
print(y)

Submission status: Accepted

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