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:
def resolve():
    N = int(input())
    T, A = [int(i) for i in input().split()]
    H = [int(i) for i in input().split()]
    absList = []
    for i in range(N):
        absList.append((abs(A - (T - (H[i] * 0.006))), i))
    print(min(absList)[1] + 1)


resolve()

Submission status: Accepted

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

Submission status: Accepted

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

# print(n)
# print(t)
# print(a)
# print(h_l)

min_a_tono_sa = 999999
index = 0
for i in range(len(h_l)):
    h = h_l[i]
    heikin_kion = t - h * 0.006
    # print(heikin_kion)
    a_tono_sa = abs(a - heikin_kion)
    # print(a_tono_sa)
    
    if min_a_tono_sa > a_tono_sa:
        min_a_tono_sa = a_tono_sa
        index = i + 1
        
print(index)

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

cand = float('inf')
ans = 1

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

k=0
m=100000000000000
for i in range(1,n+1):
    b=a-t+h[i-1]*0.006
    if m>abs(b):
        m=abs(b)
        k=i


print(k)

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    t, a = map(int, input().split())
    h = list(map(int, input().split()))
    c = 10000
    ci = 0
    for i, x in enumerate(h):
        tmp = abs(a - (t - x * 0.006))
        if c > tmp:
            c = tmp
            ci = i
    print(ci + 1)

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N = int(input())
T, A = list(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()))

def htemp(h):
    return abs(a - ((t * 1000) - (h * 6)) / 1000)

ans = list(map(htemp, h))
ans1 = ans.index(min(ans)) + 1

print(ans1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
lst = list(map(int, input().split()))
print(lst.index(min(lst, key=lambda x: abs(a - (t - x * 0.006)))) + 1)

Submission status: Accepted

Solution code:
#n = 候補の数
n = int(input())
#t - h[i] * 0.006
#a = 基準温度
t,a = map(int,input().split())
h = list(map(int,input().split()))
#o = 計算結果格納
o = []

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

#p = 基準温度に最も近い場所の差
p = abs(a - o[0])
#q = 基準地点の番号
q = 0
for i in range(n)[1:]:
    if abs(a - o[i]) < p:
        p = abs(a - o[i])
        q = i

print(q + 1)

Submission status: Accepted

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

print(sorted([(abs(A - (T - h * 0.006)), i+1) for i,h in enumerate(H)])[0][1])

Submission status: Accepted

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

near = sys.maxsize
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

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


diff = 10**6
index = 0
for i, j in enumerate(h):
    if diff > abs(j-a):
        diff = abs(j-a)
        index = i+1
print(index)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, t, a, *h = map(int, open(0).read().split())
h = list(map(lambda x: abs(a-(t-x*0.006)), h))
a = list(enumerate(h))
a.sort(key=lambda x: x[1])
print(a[0][0]+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
T, A = mapint()
Hs = list(mapint())
ths = [(abs(A-(T-(x*0.006))), i+1) for i, x in enumerate(Hs)]
ths.sort()

print(ths[0][1])

Submission status: Accepted

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

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())
hh = tuple(map(int, input().split()))

ans = 0
for i in range(1, n):
    if abs(t - hh[ans] * 0.006 - a) > abs(t - hh[i] * 0.006 - a):
        ans = i
print(ans + 1)

Submission status: Accepted

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

def calc_tem(H):
    return abs(A - ((T*1000) - (H*6)) / 1000)

new_lis = list(map(calc_tem, lis))
ans = new_lis.index(min(new_lis)) + 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
x=list(map(int,input().split()))
ans=0
cnt=10**3
for i in range(len(x)):
  s=t-x[i]*0.006
  if abs(s-a)<cnt:
    cnt=abs(s-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()))


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:
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
ans=0
check=10**9
for i in range(N):
  ondo=T-H[i]*0.006
  temp_val=abs(A-ondo)
  if temp_val<check:
    check=temp_val
    ans=i+1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
T, A = map(int, input().split())
H = map(int, input().split())
scores = {}
for i, h in enumerate(H, 1):
    scores[i] = abs (A - (T - h * 0.006))
print(min(scores, key=scores.get))

Submission status: Accepted

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

Submission status: Accepted

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

HT = []

for i in range(N):
  HT.append(T - H[i] * 0.006)
  
num = 0
  
for i in range(N):
  if abs(A - HT[num]) > abs(A - HT[i]):
    num = i
    
print(num + 1)

Submission status: Accepted

Solution code:
n, t, a, *h = map(int, open(0).read().split())
ans = 0
diff_a = float('inf')
for i in range(n):
    if diff_a > abs(a - (t - h[i] * 0.006)):
        ans = i+1
        diff_a = abs(a - (t - h[i] * 0.006))
print(ans)

Submission status: Accepted

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

temp = list(map(lambda x: abs(A - (T - x*0.006)), H))
print(temp.index(min(temp))+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(lambda x: int(x) * 1000, input().split())
h = list(map(lambda x: t - int(x) * 6, input().split()))
print(min(range(n), key=lambda x: abs(h[x]-a)) + 1)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

    return

resolve()

Submission status: Accepted

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

dif_list = []

for i in range(n):
    t_i = t - list[i] * 0.006
    t_i_dif = abs(a - t_i)
    dif_list.append(t_i_dif)

Min = min(dif_list)
print(dif_list.index(Min) + 1)

Submission status: Accepted

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

dif_list = []
answer = 0

for i in range(n):
    t_i = t - list[i] * 0.006
    t_i_dif = abs(a - t_i)
    dif_list.append(t_i_dif)
    if min(dif_list) == t_i_dif:
        answer = i + 1

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
T,A=map(int,input().split())
mylist=list(map(int,input().split()))
mymin=10**6
index=0

for i in range(N):
  if(mymin>abs(A-(T-0.006*mylist[i]))):
    mymin=abs(A-(T-0.006*mylist[i]))
    index=i
print(index+1)

Submission status: Accepted

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

Submission status: Accepted

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

temp = [t-hh*0.006 for hh in h]

dist = float('inf')
ans = -1
for i, t in enumerate(temp):
    if abs(t-a) <= dist:
        ans = i+1
        dist = 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()))
mini = 10000
ans = -1
for i in range(N):
    dt = abs(T - H[i]*0.006 - A)
    if dt < mini:
        ans = i
        mini = dt
print(ans+1)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
import bisect

N = i()
T,A = I()
H = l()
h = copy(H)
H.sort()
B = (T-A)/0.006
i = bisect.bisect_left(H,B)
if  abs((T-H[i-1]*0.006)-A)> abs(A-(T-H[i]*0.006)):
    print(h.index(H[i])+1)
else:
    print(h.index(H[i-1])+1)

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *

import numpy as np

import math

if __name__ == '__main__':
    n = int(input())
    b, c = map(int, input().split())
    list = []
    min = 10000000000
    d = [int(i) for i in input().split()]
    c = c * 1000

    for i in d:
        a = b *1000 - i * 6
        diff = 0
        if (a > 0 and c > 0) or (a < 0 and c < 0):
            diff = abs(c - a)
        else:
            diff = abs( a) +abs(c)
        list.append(diff)
        if min > diff:
            min = diff
    print(list.index(min) + 1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
s=list(map(int,input().split()))
l=[]
x=(t-a)//0.006

for i in range(n):
    l.append(abs(x-s[i]))
    
y=l.index(min(l))
print(y+1)

Submission status: Accepted

Solution code:

def main():
    n = int(input())
    t, a = map(int, input().split())
    ans = 0
    x = 100000
    for i, h in enumerate(map(int, input().split())):
        temp = abs(a - (t - h * 0.006))
        if temp < x:
            x = temp
            ans = i+1

    print(ans)

main()

Submission status: Accepted

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

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

tmp = 1001001001
ans = 0
for i in range(n):
    ab = t - lis[i]*0.006
    
    if abs(ab - a) < abs(tmp - a):
        ans = i
        tmp = ab
        
print(ans+1)

Submission status: Accepted

Solution code:
def actual(n, t, a, H):
    avg_temperture = lambda height: t - (height * 0.006)
    diff_a = lambda avg_temperture: abs(avg_temperture - a)

    temperature_diffs = [diff_a(avg_temperture(h)) for h in H]

    return temperature_diffs.index(min(temperature_diffs)) + 1

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

print(actual(n, t, a, H))

Submission status: Accepted

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

ans_ind = 0
ans_d = 1e9

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

Submission status: Accepted

Solution code:
import math
from collections import deque
from collections import defaultdict

import itertools as it

#自作関数群
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	#data = [2]
	data = [0,0,0]
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	#ans = [x for x in data if x!=0]
	ans = data[:]
	return ans

n = readInt()
t,a = readInts()
h = readInts()

ans = 1
ran = float("inf")

for i in range(n):
	x = t-h[i]*0.006
	if ran>abs(x-a):
		ran = abs(x-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()))
ch = [10000]*n
for i in range(n):
    ch[i] = abs(a - (t - h[i]*6/1000))
print(ch.index(min(ch))+1)

Submission status: Accepted

Solution code:
def mi():
    return map(int, input().split())

def main():
    N = int(input())
    T, A = mi()
    H = list(mi())
    tmps = [abs(T-h*0.006-A) for h in H]
    print(tmps.index(min(tmps))+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()))

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def ip():return int(input())
def imp():return map(int,input().split())
def impstr():return map(str,input().split())
def limp():return list(map(int,input().split()))

n=ip()
t,a=imp()
h=limp()
index=0
ans=10**18
for i in range(n):
    if abs(a-(t-h[i]*0.006))<ans:
        ans=abs(a-(t-h[i]*0.006))
        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()))

sa = [abs(A - (T - 0.006*hi)) for hi in H]

mn = 1000
ans = -1
for i in range(N):
  if sa[i] < mn:
    ans = i+1
    mn = sa[i]
    
print(ans)

Submission status: Accepted

Solution code:
a = int(input())
x  = 0
lists = []
ass =[]
#bが気温c、standardが平均気温の基準
b,standard = map(int,input().split())
#標高
elev = list(map(int,input().split()))

for i in range(a):
    lists.append(abs(b - elev[i] * 0.006 - standard))

m = min(lists)
mindex = lists.index(m)
print(mindex + 1)

Submission status: Accepted

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

Submission status: Accepted

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

diff = 1e9
ans = 0
for i in range(n):
  h[i] = t - h[i] * 6
  if abs(a - h[i]) < diff:
    diff = abs(a - h[i])
    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()))

def tem(hi):
  return t-(hi*0.006)
good=2000000000
num=-1
i=1
for hi in h:
  x=abs(tem(hi)-a)
  if x<good:
    good=x
    num=i
  i+=1
  
print(num)

Submission status: Accepted

Solution code:
import bisect
import copy
from decimal import Decimal
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
L = copy.copy(H)
H.sort()
s = Decimal((T-A)/0.006)
B1 = bisect.bisect_left(H,s)
B2 = B1-1
if B1 == 0:
    print(L.index(H[B1])+1)
elif B1 == N:
    print(L.index(H[B2])+1)
elif H[B1]-s < s-H[B2]:
    print(L.index(H[B1])+1)
else:
    print(L.index(H[B2])+1)

Submission status: Accepted

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

mi = 1000000
ans = 0
for i in range(n):
    deg = abs(1000*t - 6*h[i] - 1000*a)
    if mi > deg:
        mi = deg
        ans = i+1
print(ans)

Submission status: Accepted

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

for height in l:
  deltatemperature.append(abs(T- height* 0.006- A))
  
m = min(deltatemperature)
mindex = deltatemperature.index(m)
print(mindex+ 1)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

tmp = 10 ** 9
ans = -1

for i in range(len(Tmp)):
    if tmp > abs(A-Tmp[i]):
        tmp = abs(A-Tmp[i])
        ans = i

print(ans+1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
hs=list(map(int,input().split()))
n=0
m=float('inf')
for i,h in enumerate(hs, start=1):
    x=abs(a-(t-h*0.006))
    if m>x:
        m=x
        n=i
print(n)

Submission status: Accepted

Solution code:
n = int(input())
T,a = map(int, input().split())
A = list(map(int, input().split()))
ANS = []
for i in range(len(A)):
  t = T - A[i] * 0.006
  ANS.append(abs(t-a))
  
for i in range(len(ANS)):
  if ANS[i] == min(ANS):
    print(i+1)
    exit()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC 113 B - Palace
import numpy as np
def getNearestIndex(list, num):
    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()))
result = [0] * N

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

resultNum = getNearestIndex(result, A)
print(resultNum + 1)

Submission status: Accepted

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

b = t - h[0]*0.006
ans = 1

for i, name in enumerate(h, 1):
  temp = t - name*0.006
  if abs(a - temp) < abs(a - b):
    ans = i
    
    b = temp
print(ans)

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):
    d[i] = abs((t - h[i] * 0.006) - a)

d = sorted(d.items(), key=lambda x:x[1])
print(d[0][0] + 1)

Submission status: Accepted

Solution code:
n=int(input())
t,a=list(map(float,input().split()))
h=list(map(int,input().split()))
tmp=float(1e9+7)
ans=0
for i in range(n):
    if abs(a-(t-h[i]*0.006))<tmp:
        tmp=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()))
arr = []
for e in h:
  arr.append(abs(a - (t - e * 0.006)))
print(arr.index(min(arr)) + 1)

Submission status: Accepted

Solution code:
n = int(input())
t, a = map(int, input().split())
hl = list(map(int, input().split()))
ll = [t-h*0.006-a for h in hl]
ans = 1
dd = 1000000000
for i in range(n):
    if ll[i] >= 0 and ll[i] < dd:
        ans = i+1
        dd = ll[i]
    elif ll[i] < 0 and -ll[i] < dd:
        ans = i+1
        dd = -ll[i]
    else:
        pass

print(ans)

Submission status: Accepted

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

h=list(map(int,input().split()))
mn=10**5

for i in range(n):
  dt=abs(a-(t-h[i]*0.006))
  if dt<mn:
    mn=dt
    mni=i+1
print(mni)

Submission status: Accepted

Solution code:
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
diff=float('inf')
ans=0
for i in range(n):
    tmp=abs(a-(t-h[i]*0.006))
    if tmp<diff:
        diff=tmp
        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()))
temp = []
for i in range(n):
    temp.append(t - h[i] * 0.006)
for i in range(n):
    h[i] = abs(a - temp[i])
ans = 0
turn = h[0]
for i in range(n):
    if h[i] < turn:
        ans = i
        turn = h[i]
print(ans + 1)

Submission status: Accepted

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

near_i = -1
min_diff = 10**6 * 0.006
for i, h in enumerate(H):
    temp = T - h * 0.006
    diff = abs(A - temp)
    if diff < min_diff:
        min_diff = diff
        near_i = i
print(near_i+1)

Submission status: Accepted

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

cand1 = 10**9
for i in range(N):
    cand2 = abs(T-H[i]*0.006-A)
    if cand2<cand1:
        out = i+1
        cand1 = cand2
print(out)

Submission status: Accepted

Solution code:
import sys
N = int(sys.stdin.readline().rstrip())
T, A = map(int, sys.stdin.readline().rstrip().split())
H = list(map(int, sys.stdin.readline().rstrip().split()))
res = 10**10
ans = -1
for i, h in enumerate(H):
    if res > abs(A - (T - h * 0.006)):
        ans = i
        res = abs(A - (T - h * 0.006))
print(ans + 1)

Submission status: Accepted

Solution code:
n = int(input())
t,a = map(int,input().split())
H = list(map(int,input().split()))
x = float('inf')
for i in range(len(H)):
    tmp = t - H[i]*0.006
    tmp2 = abs(a-tmp)
    if tmp2 < x:
        ans = i+1
        x = tmp2

print (ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    T, A = map(int, input().split())
    H = map(int, input().split())
    ans = float('inf')
    ans_i = 0
    for i, v in enumerate(H):
        tmp = abs(A - (T - 0.006 * v))
        if ans > tmp:
            ans_i = i
            ans = tmp
    print(ans_i+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()))
def kion(x):
  return T-x*0.006
ans=[abs(A-kion(h)) for h in H]
p=ans.index(min(ans))+1
print(p)

Submission status: Accepted

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

temparature = list(map(lambda x: abs(T - x * 0.006 - A), H))
# print(f"H:{H} temparature:{temparature}", file=sys.stderr)
min_index = 0
min_temp = 0
for i, t in enumerate(temparature):
    if i == 0:
        min_temp = t
    else:
        if min_temp > t:
            min_index = i
            min_temp = t
print(min_index + 1)

Submission status: Accepted

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

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

ans = min(H.items(), key=lambda x:x[1])
print(ans[0]+1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial#, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    n = i_input()
    t, a = i_map()
    num_list = i_list()

    abs_num = INF
    ans = 0

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

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

#print(TM)
print(TM.index(min(TM))+1)

Submission status: Accepted

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

l = [abs((T - x * 0.006) - A) for x in H]
print(l.index(min(l)) + 1)

Submission status: Accepted

Solution code:
N = int(input())
temp = [int(i) for i in input().split(' ')]
T = temp[0]
A = temp[1]
H = [int(i) for i in input().split(' ')]

min_temp = float('inf')
for i,h in enumerate(H):
  t = T - h*0.006
  diff = abs(t-A)
  if diff<min_temp:
    min_temp = diff
    min_index = i+1

print(min_index)