Problem:


Score : 300 points

Problem Statement

You have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \leq i \leq N) is v_i.

When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.

After you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.

Constraints

2 \leq N \leq 50

1 \leq v_i \leq 1000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
v_1 v_2 \ldots v_N

Output

Print a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.

Your output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.

Sample Input 1

2
3 4

Sample Output 1

3.5

If you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5.

Printing 3.50001, 3.49999, and so on will also be accepted.

Sample Input 2

3
500 300 200

Sample Output 2

375

You start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:

Use the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400. The next composition will use this ingredient and the ingredient of value 200, resulting in an ingredient of value (400 + 200) / 2 = 300.

Use the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350. The next composition will use this ingredient and the ingredient of value 300, resulting in an ingredient of value (350 + 300) / 2 = 325.

Use the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250. The next composition will use this ingredient and the ingredient of value 500, resulting in an ingredient of value (250 + 500) / 2 = 375.

Thus, the maximum possible value of the last ingredient remaining is 375.

Printing 375.0 and so on will also be accepted.

Sample Input 3

5
138 138 138 138 138

Sample Output 3

138



Sample input:
2
3 4


Sample output:
3.5

Submission status: Accepted

Solution code:
n=int(input())
v =list(map(int,input().split()))
v.sort()
x = v[0]
if n > 2:
        for i in range(1,n):
            x += v[i]*2**(i-1)

        ans = x/2**(n-1)
        print(ans)

else:
        print((x+v[1])/2)

Submission status: Accepted

Solution code:
# C - Alchemist
N = int(input())
v = list(map(int,input().split()))
v.sort(reverse=True)
ans = 0
for i in range(N):
    ans += v[i]/(2**(i+1))
ans += v[-1]/(2**N)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort()
tmp = A[0]
for i in range(1,N):
  tmp = (tmp+A[i])/2
print(tmp)

Submission status: Accepted

Solution code:
a=int(input())
b=list(map(int,input().split()))
b.sort()
c=b[0]
for i in range (a-1):
  c=(c+b[i+1])/2
print(c)

Submission status: Accepted

Solution code:
N = int(input())
S = list(map(int,input().split()))
S = sorted(S)
a = S[0]
for i in range(N-1):
  a = (a + S[i+1])/2
  
print(a)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))

V.sort()

res = V[0]

for i in range(1, N):
    res += V[i] * 2**(i - 1)

print(res / 2**(N - 1))

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    for i in range(N - 1):
        A[i + 1] = (A[i + 1] + A[i]) / 2
    print(A[-1])
    return

solve()

Submission status: Accepted

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


# inputna
n = int(input())
v = list(map(int, input().split()))
from heapq import heappop as hpp, heappush as hp
h = []
for num in v:
    hp(h, num)
while len(h)>=2:
    v0, v1 = hpp(h), hpp(h)
    hp(h, (v0+v1)/2)
ans = h[0]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
v_s = sorted(v)
m = v_s[0]
for i in range(n-1):
  m  = (m + v_s[i+1]) / 2
print(m)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
while len(v) != 1:
  v.sort()
  v[0] = (v[0]+v[1])/2
  v.pop(1)
print(v[0])

Submission status: Accepted

Solution code:
a = int(input())
b = list(map(int,input().split()))
b.sort()
c = b[0]
for i in range(1,a):
  c += b[i]
  c /= 2
print(c)

Submission status: Accepted

Solution code:
n = int(input())
v =list(map(int, input().split()))
l = [0]*n
s = 0
l = sorted(v)
s = l[0]
for i in range(1,n):
  s = (s+l[i])/2
print(s)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = A[0]
for i in range(1, N):
  ans = (ans + A[i])/2
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
v = [int(x) for x in input().split()]
v.sort()
ans = (v[0]+v[1])/2.0
for i in range(2, N):
  ans = float(ans+v[i])/2
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
x = list(map(int, input().split()))
x.sort()
ans=x[0]
for i in range(N-1):
    ans=(ans+x[i+1])/2
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse = False)
for i in range(N-1):
    a[i+1] = (a[i] + a[i+1]) / 2

print (a[N-1])

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort()
ans=v[0]
for i in v:
  ans=(ans+i)/2
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    v_list = list(map(int, input().split()))
    v_list.sort()
    ans = 0

    for i in range(n):
        if i == 0 or i == 1:
            ans += v_list[i] / 2 ** (n - 1)
        else:
            ans += v_list[i] / 2 ** (n - i)

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
v = sorted(map(int, input().split()))

tmp = v[0]
for i in range(1,N):
  tmp = (tmp+v[i])/2.0
  
print(tmp)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))

v.sort()
total = v[0]
for i in range(1, len(v)):
    total = (total + v[i]) / 2
    
print(total)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    v = list(map(int, readline().split()))
    v.sort()
    cur = v[0]

    for i in range(1, N):
        cur += v[i]
        cur /= 2

    print(cur)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
li=list(map(int, input().split()))
li.sort()
ans=li[0]
for i in range(1,n):
    ans=(ans+li[i])/2
print(ans)

Submission status: Accepted

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

v.sort()

total = v[0]
for i in range(1, n):
    total = (total + v[i])/ 2
    
print(total)

Submission status: Accepted

Solution code:
N = int(input())
materials = list(map(int, input().split()))

for _ in range(N-1):
	materials.sort()
	new_material = (materials[0] + materials[1])/2
	materials.pop(0)
	materials.pop(0)
	materials.append(new_material)
	
print(materials[0])

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
if N == 2:
    print((V[0]+ V[1])/2)
else:
    V.sort()
    kati = V[0]
    for i in range(1, N):
        kati = (kati + V[i]) / 2
    print(kati)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
for i in range(1, N):
  A[i] = (A[i-1] + A[i])/2
print(A[N-1])

Submission status: Accepted

Solution code:
a=int(input())
b=list(map(int,input().split()))
c=min(b)
d=0
b.pop(b.index(min(b)))
while True:
    if b==[]:
        break
    c+=min(b)
    b.pop(b.index(min(b)))
    d=c/2+d/2
    c=0
print(d)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
l.sort()  
s=(l[0]+l[1])/2
for i in range(2,len(l)):
  s=(s+l[i])/2
print(s)

Submission status: Accepted

Solution code:
import heapq
n = int(input())
heap_a = list(map(int, input().split()))

# N＝５０だと、多くても４９
# > 愚直にやっても大丈夫なはず。なるべく早く実行するために、Heapqを使用する。

heapq.heapify(heap_a)

#tar = heapq.nsmallest(2, heap_a)
while True:
    tar1 = heapq.heappop(heap_a)
    tar2 = heapq.heappop(heap_a)

    heapq.heappush(heap_a, (tar1 + tar2) / 2.0)
    if (len(heap_a) == 1):
        break


print(heapq.heappop(heap_a))

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int,input().split()))
while len(v)!=1:
    v=sorted(v)
    x=(v[0]+v[1])/2
    v.pop(0)
    v.pop(0)
    v.append(x)
print(v[0])

Submission status: Accepted

Solution code:
n=int(input())

v=list(map(int,input().split()))
v.sort()

for i in range(n-1):
    v[i+1]=(v[i]+v[i+1])/2
print(v[n-1])

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split()))

V.sort()

res = V[0]
for i in range(N-1):
  res = (res + V[i+1])/2

print(res)

Submission status: Accepted

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

v.sort()
for i in range(n-1):
  v[i+1]=(v[i]+v[i+1])/2
print(v[n-1])

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    v = [int(_) for _ in input().split()]
    sort_v = sorted(v)

    while len(sort_v) > 1:
        temp_a = sort_v[0]
        temp_b = sort_v[1]
        sort_v.pop(0)
        sort_v[0] = (temp_a + temp_b)/2
        sort_v = sorted(sort_v)

    print(sort_v[0])


if __name__ == "__main__":
    main()

Submission status: Accepted

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

now = 0
a = sorted(value) ##value.sort() だとvalueで2行目を参照してしまう？

while len(a) >= 2:
  a = sorted(a)
  now = (float(a[0]) + float(a[1])) / float(2)
  if len(a) >= 3:
    del a[0],a[0] ##a[0],a[1]にしてた
    a.append(now)
  elif len(a) == 2:
    print(now)
    break

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int,input().split()))
v.sort()
result = v[0]

for i in range(N-1):
  result = (result + v[i+1]) / 2
  
print(result)

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
V = [int(v) for v in stdin.readline().rstrip().split()]

V.sort()

now = V[0]

for v in V[1:]:
    now = (now + v)/2

print(now)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
v.sort()
temp = v[0]
for i in range(1,n):
  temp = (temp + v[i])/2
print(temp)

Submission status: Accepted

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

import heapq

n = int(input())
u = list(map(int, input().split()))
heapq.heapify(u)
for _ in range(n-1):
    heapq.heappush(u, (heapq.heappop(u) + heapq.heappop(u)) / 2)

print(heapq.heappop(u))

Submission status: Accepted

Solution code:
n = int(input())
lis = list(map(int, input().split()))
lis.sort()
x = 0
y = 0

for i in range(n):
  if i == 0:
    x = lis[i]
  else:
    x = (x + lis[i]) / 2
    
print(x)

Submission status: Accepted

Solution code:
N,*V=map(int,open(0).read().split())
A=sorted(V)
for n in range(N-1):
    A=sorted([(A[0]+A[1])/2,]+A[2:])
print(A[0])

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())))

while len(v) > 1:
  v.insert(2, (v[0]+v[1])/2)
  v = v[2:]
print(*v)

Submission status: Accepted

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

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

def main():
    mod=10**9+7
    N=I()
    v=LI()
    v.sort()
    ans=v[0]
    for i in range(1,N):
        ans=(ans+v[i])/2
    print(ans)

main()

Submission status: Accepted

Solution code:
n=int(input())
v=sorted(list(map(int,input().split())))
ans=v[0]
for i in range(1,n):
    ans=(ans+v[i])/2
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = sorted(list(map(int,input().split())))

ans = (V[0]+V[1])/2**(len(V)-1)

for i in range(2,N):
    ans += V[i]/2**(N-i)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
M = list(map(int,input().split()))

M.sort()
x = (M[0]+M[1])/2

for m in M[2:] :
    x = (x+m)/2

print(x)

Submission status: Accepted

Solution code:
import heapq
N = int(input())
V = list(map(int, input().split()))
heapq.heapify(V)
for i in range(N-1):
  v1 = heapq.heappop(V)
  v2 = heapq.heappop(V)
  heapq.heappush(V, (v1 + v2) / 2)
print(heapq.heappop(V))

Submission status: Accepted

Solution code:
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, Vs):
    Vs.sort()
    ans = Vs[0]
    for i in range(1, N):
        ans = (ans + Vs[i]) / 2
    print(ans)


if __name__ == '__main__':
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    Vs = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N, Vs)

Submission status: Accepted

Solution code:
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))

  
def main():
    n = int(input())
    a = sorted(Input())
    while len(a) > 1:
        x, y = a[0], a[1]
        a[0:2] = [(x+y)/2]
    return a[0]


print(main())

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int,input().split()))
v.sort()
pot=v[0]
for i in range(1,N):
    pot = 0.5*(pot + v[i])

print(pot)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))

v.sort()

for i in range(N - 1):
    temp = (v[0] + v[1]) / 2
    v = v[2:]
    v.append(temp)
    v.sort()

print(v[0])

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int,input().split())))

val = v[0]

for i in range(1,n):
    val += v[i]
    val /= 2
print(val)

Submission status: Accepted

Solution code:
N = int(input())
V = sorted(map(int,input().split()))
potvalue = V[0]
for i in range(1,N):
    potvalue = (potvalue + V[i])/2
    
print(potvalue)

Submission status: Accepted

Solution code:
# 問題：https://atcoder.jp/contests/abc138/tasks/abc138_c

n = int(input())
v = list(map(int, input().strip().split()))
v.sort(reverse=True)
res = 0
for i in range(n-1):
    res += v[i] / (2**(i+1))
res += v[-1] / (2**(n-1))

print(res)

Submission status: Accepted

Solution code:
import collections
n = int(input())
v = collections.deque(sorted(list(map(int, input().split()))))

while len(v) > 1:
    x = (v.popleft()+v.popleft())/2
    v.append(x)
    v = collections.deque(sorted(list(v)))
print(v[0])

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())
v = deque(sorted(list(map(int, input().split()))))
for i in range(n-1):
    v1 = v.popleft()
    v2 = v.popleft()
    v.appendleft((v1+v2)/2)
print(v[0])

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int,input().split()))
v_sort=sorted(v,reverse=False)
while len(v_sort)>1:
    v_sort=sorted(v_sort,reverse=False)
    v_sort.append((v_sort[0]+v_sort[1])/2)
    del v_sort[0]
    del v_sort[0]
print(*v_sort)

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int,input().split()))
v_sort=sorted(v,reverse=False)
for i in range(N):
    v_sort=sorted(v_sort,reverse=False)
    v_sort.append((v_sort[0]+v_sort[1])/2)
    del v_sort[0]
    del v_sort[0]
    if len(v_sort)==1:
        break
print(*v_sort)

Submission status: Accepted

Solution code:
N=int(input())
V=list(map(int, input().split()))
V.sort()
tmp=(V[0]+V[1])/2
for i in range(2,N):
  tmp=(tmp+V[i])/2
print(tmp)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
a.sort()
sum = a[0]
for i in range(1,n):
    sum = (sum + a[i])/2
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
v.sort()

for i in range(0,n-1):
  sum = (v[i] + v[i+1])/ 2
  v[i+1] = sum 

print(v[n-1])

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
V.sort()

ans = 0
for i in range(N - 1):
    m = (V[i] + V[i+1]) / 2
    V[i+1] = m
    ans = m
print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np
import numba
from numba import jit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from heapq import heappop,heappush,heapify

@jit
def main(n, a):
  for _ in range(1, n):
    x = heappop(a)
    y = heappop(a)
    heappush(a, (x + y)/2)
  return a[0]

n,*a = map(int,read().split())
heapify(a)
print(main(n,a))

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int,input().split()))
v.sort()
ans=0
for i in range(N):
    ans+=(v[i])/(2**(N-i))
ans+=(v[0])/(2**N)
print(ans)

Submission status: Accepted

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

num=(l[0]+l[1])/2
l.pop(0)
l.pop(0)
if len(l) > 0:
  for i in range(n-2):
    num=(num+l[0])/2
    l.pop(0)
  
print(num)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
sort_v = sorted(v)
ans = 0
tmp = sort_v[0]
for i in range(1,n):
    tmp = (tmp + sort_v[i])/2
print(tmp)

Submission status: Accepted

Solution code:
n=int(input())
v=[int(x) for x in input().split()]
v.sort()
while len(v)!=1:
  a=v.pop(0)
  b=v.pop(0)
  v.append((a+b)/2)
  v.sort()
print(v[0])

Submission status: Accepted

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

if n == 2:
    ans = (values[0] + values[1])/2
else:
    while len(values) > 1:
        values.sort()
        tmp = (values[0] + values[1])/2
        values.pop(0)
        values.pop(0)
        values.append(tmp)
    ans = values[0]

print(ans)

Submission status: Accepted

Solution code:
import heapq

N=int(input())
arr=list(map(int,input().split()))
hq=[]

for i in range(N):
    heapq.heappush(hq,arr[i])
    
while len(hq)>1:
    a=heapq.heappop(hq)
    b=heapq.heappop(hq)
    heapq.heappush(hq,(a+b)/2)

print(*hq)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
v.sort()
price = v[0]

for i in range(1, n):
  price = (price + v[i]) / 2

print(price)

Submission status: Accepted

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

v.sort()

cnt=(v[0]+v[1])/2

for i in range(2,n):
  a=(v[i]+cnt)/2
  cnt=a
  
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))

V = sorted(v)

ans = V[0]

for i in range(N-1):
    ans = (ans + V[i+1]) /2

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
v = [int(v) for v in input().split()]

v_sorted = sorted(v)

new_list = []
for i in range(len(v)):
    if i == 0 or i == 1:
        new_list.append(v_sorted[i] / 2**(len(v)-1))
    else:
        new_list.append(v_sorted[i] / 2 ** (len(v)-i))
    
print(sum(new_list))

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
l.sort()
s=l[0]
for i in range(1,n):
    s+=l[i]
    s=s/2
print(s)

Submission status: Accepted

Solution code:
n = int(input())
vv = sorted([int(x) for x in input().split()])

while len(vv) > 1:
  a, b = vv[:2]
  vv = vv[2:]
  vv = sorted([(a + b) / 2] + vv)

print(vv[0])

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split()))

nV = sorted(V)
res = 0
res += (nV[0]+nV[1])/(2**(N-1))

for i in range(2,N):
  res += nV[i]/(2**(N-i))
    
print(res)

Submission status: Accepted

Solution code:
from heapq import heappop,heappush,heapify

N = int(input())
heap = list(map(int,input().split()))
heapify(heap)

while(len(heap)>=2):
    x = heappop(heap)
    y = heappop(heap)
    #print(x,y)
    heappush(heap,(x+y)/2)
print(heappop(heap))

Submission status: Accepted

Solution code:
from functools import reduce
n=int(input())
v=sorted([int(i)for i in input().split()])
x=lambda x,y:(x+y)/2
res=reduce(x,v)
print(res)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int,input().split()))
A.sort()
from collections import deque
q = deque(A)
s = (A[0] + A[1])/2
q.popleft()
q.popleft()
while q:
    t = q.popleft()
    s +=t
    s/=2
print(s)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
v.sort()
now = v[0]
for i in range(1,n):
    now = (now + v[i])/2
print(now)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
V.sort()

for n in range(N-1):
    x = V.pop(0)
    y = V.pop(0)
    V.append((x+y)/2)
    V.sort()
print(V[0])

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))
V = sorted(v, reverse=True)
A = 0

while N > 1:
  v1 = V.pop()
  v2 = V.pop()
  A = (v1 + v2)/2
  V.append(A)
  N -= 1

print(V[0])

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))

v = sorted(v)
ans = (v[0] + v[1]) / 2
for i in range(2, N):
    ans = (ans + v[i]) / 2
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))
v.sort()
val = v[0]
for i in range(1, N):
    val=(val+v[i])/2
print(val)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))

v.sort()

num = v[0]+v[1]
den = 2
for i in range(2, N):
    num += den * v[i]
    den *= 2

ans = num / den
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
val_list =list(map(int, input().split()))
val_list.sort()
ans = val_list[0]*0.5**(n-1)
for i in range(1,n):
    ans += val_list[i]*(1/2)**(n-i)
    
print(ans)

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
v = list(map(int,input().split()))
v.sort()
print(reduce(lambda a,b : (a+b)/2,v))

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(lambda v: int(v), input().split(" ")))
V.sort()

a = V[0]
for i in range(len(V) - 1):
  a = (a + V[i + 1])/2

print(a)

Submission status: Accepted

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

for i in range(n-1):
	x = min(v)
	v.remove(x)
	y = min(v)
	v.remove(y)
	v.append((x+y)/2) 

print(v[0])

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))
v.sort()
for i in range(N-1):
    v[0] = (v[0]+v[1])/2
    v.pop(1)
print(*v)

Submission status: Accepted

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

while len(l) > 1:
  l = sorted(l)
  f = l.pop(0)
  s = l.pop(0)
  l.append( ( f + s ) / 2 )

print(l[0])

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int,input().split())))
ans = (v.pop(0)+v.pop(0))/2

if v:
    for i in v:
        ans = (ans+i)/2

print (ans)

Submission status: Accepted

Solution code:
def ing(arr):
	summ = arr[0]
	for i in range(1, len(arr)):
		summ = (summ + arr[i]) / 2
	return summ
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
print(ing(arr))

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
sv = sorted(V)
ans = sv[0]
for i in range(1, N):
	ans = (ans + sv[i]) / 2
print(ans)

Submission status: Accepted

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

v.sort()
for i in range(n-1):
    if i == 0:
        t = (v[i] + v[i+1]) / 2
    else:
        t = (t + v[i+1]) / 2

print(t)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int,input().split()))

v = sorted(v, reverse = False)
def average(x,y):
    XY = (x + y) / 2
    return XY

gen = v[0]
for i in range(1,N):
    gen = average(gen ,v[i])

print(gen)

Submission status: Accepted

Solution code:
N = int(input())
v = sorted(list(map(int,input().split())))
ans = v[0]
for i in range(1,N):
    ans = (ans + v[i])/2 
    
print(ans)

Submission status: Accepted

Solution code:
from collections import deque
N = int(input())
v = list(map(int, input().split()))

v.sort()
q = deque(v)
for i in range(N-1):
    x, y = q.popleft(), q.popleft()
    q.appendleft((x + y) / 2)
print(q.pop())

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())))
nv = (v[0] + v[1]) / 2
for i in range(2, n):
    nv = (nv + v[i]) / 2
print(nv)

Submission status: Accepted

Solution code:
N = int(input())
*A, = map(int, input().split())
A.sort()
ans = (A[0]+A[1])/2
for a in A[2:]:
    ans = (ans+a)/2
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
List = list(map(int, input().split()))
List.sort()
for i in range(N-1):
  res = (List.pop(0)+List.pop(0))/2
  List.append(res)
  List.sort()
print(res)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))

v = sorted(v)
ans = v[0]
for i in range(1, N):
    ans = (ans + v[i]) / 2
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
v = sorted(map(int, input().split()))

for i in range(N-1):
	v[i+1] = (v[i]+v[i+1])/2
print(v[N-1])

Submission status: Accepted

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

v = sorted(v)
# print(v)
while len(v) != 1:
    a = v.pop(0)
    b = v.pop(0)
    avg = (a+b)/2
    # print(a, b, avg)
    v.append(avg)
    v = sorted(v)

print(v[0])

Submission status: Accepted

Solution code:
n =int(input())
V = list(map(int,input().split()))
V.sort()

ans = V[0]
for i in range(1,n):
    ans = (ans+V[i])/2

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort(key=int)
for i in range(n-1):
  z=(v[i]+v[i+1])/2
  v[i]=z
  v[i+1]=z
print(v[n-1])

Submission status: Accepted

Solution code:
import math

N = int(input())
v = list(map(int, input().split()))
v.sort()
for i in range(N-1):
    v.append( ( v.pop(0) + v.pop(0) ) / 2 )
    v.sort()
print(v[0])

Submission status: Accepted

Solution code:
N = int(input())
l = list(map(int,input().split()))
ans = 0
l.sort()
for i in range(N):
  ans += l[i]
  if i >= 1:
    ans /= 2
print(ans)

Submission status: Accepted

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

v.sort()

s = v[0]

for i in range(1, n):
    s = (s + v[i]) / 2

print(s)

Submission status: Accepted

Solution code:
n = int(input())
m = sorted(list(map(int,input().split())))
if len(m) == 2:
    print(sum(m) / 2)
    exit()

ans = (m[0] + m[1]) / 2
for i in range(2,n):
    ans = (ans + m[i]) / 2
    
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
M=list(map(int,input().split()))
M=sorted(M)
C=(M[0]+M[1])/2
for i in range(2,N):
  C=(C+M[i])/2
print(C)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort()
now=v[0]
for i in range(1,n):
  now=(now+v[i])/2
print(now)

Submission status: Accepted

Solution code:
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    n = int(input())
    v = list(map(int, input().split()))
    v.sort()
    while len(v)>1:
        a = v[0]
        b = v[1]
        c = (a+b)/2
        v.pop(0)
        v.pop(0)
        v.insert(0, c)
    print(v[0])


if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int,input().split()))

for i in range(N-1):
    x = min(v)
    v.remove(x)
    y = min(v)
    v.remove(y)
    z = (x+y)/2
    v.append(z)
    #print(v)

print(v[-1])

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a=sorted(a)
ans=a[0]
for i in range(n-1):
    ans+=(2**i)*a[i+1]
print(ans/(2**(n-1)))

Submission status: Accepted

Solution code:
import math


def resolve():
    import sys
    input = sys.stdin.readline
    # row = [int(x) for x in input().rstrip().split(" ")]
    n = int(input().rstrip())
    v_list = [int(x) for x in input().rstrip().split(" ")]

    v_list.sort()

    ans = v_list[0]
    for i in range(1, len(v_list)):
        ans = (ans + v_list[i]) / 2

    print(ans)



if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N = int(input())

v = sorted(list(map(int,input().split())))

for p in range(N-1):
    v[p+1] = (v[p]+v[p+1])/2

print(v[N-1])

Submission status: Accepted

Solution code:
N = int(input())
r, *v = sorted(list(map(int, input().split())))
for x in v:
    r = (r+x)/2
print(r)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))
v.sort(reverse=True)
for i in range(N-1):
    a = v.pop()
    b = v.pop()
    v.append((a + b)/2)
print(v[0])

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    s = list(map(int, input().split()))
    s.sort()
    x = s[0]
    for i in range(1, n):
        x = (x + s[i]) / 2
    print(x)


solve()

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
V.sort()
res = V[0]
for v in V[1:]:
    res = (res + v)/2
print(res)

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())))
ans = v[0]
for i in range(1, n):
    ans = (ans+v[i])/2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())))
v[1] += v[0]
ans = 0
for i in range(1, n):
    ans += v[i]/(2**(n-i))
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
*v,=sorted(map(int,input().split()))

from bisect import insort
c=1
while c<N:
    insort(v,(v.pop(0) + v.pop(0)) / 2)
    c+=1
print(*v)

Submission status: Accepted

Solution code:
input()
(*v,) = sorted(map(int, input().split()), reverse=True)
v[-1] *= 2
print(sum((a / (2 ** i)) for i, a in enumerate(v, start=1)))

Submission status: Accepted

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

for i in range(n-1):
    v.sort()
    tmp = (v[0] + v[1]) / 2
    v.pop(0)
    v.pop(0)
    v.append(tmp)

print(v[0])

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
from collections import defaultdict as D
from functools import reduce
import numpy as np
import sys
import os
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353    

N = I()
v = LI()

v.sort(reverse=True)

ans = 0
for i in range(N-1):
    ans += v[i]/2**(i+1)
ans += v[N-1]/2**(N-1)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = sorted(map(int, input().split()))
ans = V[0]
for i in range(1, N):
    ans = (ans + V[i]) / 2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())))
ans = v[0]
for x in v[1:n]:
    ans = (ans + x) / 2
print(ans)