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

ret = v[0]
for i in range(N):
    if i == 0: continue
    ret = (ret + v[i]) / 2

print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(V[i+1])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans=count=0

n=int(input())
v=list(map(int,input().split()))
v.sort(reverse=1)
tmp=1
for i in range(n-1):
    tmp*=2
    ans+=v[i]/tmp
ans+=v[n-1]/tmp
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans=count=0

n=int(input())
v=list(map(int,input().split()))
v.sort(reverse=1)
tmp=1
for i in range(n-1):
    tmp*=2
    ans+=v[i]/tmp
ans+=v[n-1]/tmp
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n = inp()
vlist = np.array(inpl())
vlist.sort()
temp = vlist[0]
for i in range(len(vlist)):
    temp = (temp + vlist[i])/2.0
print(temp)

Submission status: Accepted

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

for _ in range(n-1):
    a = v.pop(0)
    b = v.pop(0)
    c = (a + b) / 2
    v.append(c)
    v.sort()

print(*v)

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(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:
import numpy as np
N=int(input())
v=np.sort(np.array(list(map(int,input().split(" ")))))
ind=np.insert(np.array(range(1,N))[::-1],0,N-1,axis=0)
print(sum(v/2**ind))

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort()
for i in range(0,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()
for i in range(n):
    if i == 0:
        s = (1/2)**(n-1) * v[0]
    else:
        s = s + (1/2)**(n-i) * v[i]
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq
import math


def solve(n, v):
    heapq.heapify(v)

    while len(v) != 1:
        x = heapq.heappop(v)
        y = heapq.heappop(v)
        z = (x + y) / 2
        heapq.heappush(v, z)

    return v[0]


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

print(solve(n, v))

Submission status: Accepted

Solution code:
from heapq import heapify,heappop,heappush
n=int(input())
a=list(map(int,input().split()))
heapify(a)
while len(a)!=1:
    b=heappop(a)
    c=heappop(a)
    heappush(a,(b+c)/2)
print(a[0])

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split()))
V.sort()
while len(V) > 1:
  tem = (V[0]+V[1])/2
  V.pop(0)
  V.pop(0)
  V.insert(0,tem)
print(V[0])

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()

val = a[0]
for i in a:
    val = (val+i)/2
    
print(val)

Submission status: Accepted

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

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

v_list.sort()

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

print(v_list[-1])

Submission status: Accepted

Solution code:
from functools import reduce

n = int(input())
vs = list(map(int, input().split()))

res = reduce(lambda x, y: (x + y) / 2, sorted(vs))
print(res)

Submission status: Accepted

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

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.sort()
V=v[0]
for i in range(N-1):
    V=(V+v[i+1])/2
print(V)

Submission status: Accepted

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

ans = 0.0
ans += (v[0] + v[1]) / 2
ans = round(ans,10)
for i in range(2,N):
    ans = ((ans + v[i]) / 2)
    ans = round(ans,10)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
n = list(map(int,input().split()))
for i in range(N-1):
    tmp = []
    tmp.append(n.pop(n.index(min(n))))
    tmp.append(n.pop(n.index(min(n))))
    n.append(sum(tmp)/2)
print(sum(n))

Submission status: Accepted

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

V.sort()

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=list(map(int,input().split()))
v=sorted(v)
c=(v[0]+v[1])/2
if len(v)>=3:
    for i in range(2,n):
        c=(c+v[i])/2
print(c)

Submission status: Accepted

Solution code:
#最初に入れれば入れるほど価値は小さくなる。つまり小さい順のリストを作り、小さい順に合成する。

n=int(input())

S=input().split()
s=list(S)

for i in range(n):
  s[i]=float(s[i])

#小さい順に並べ替え
list=sorted(s)

def mazemaze(a,b):
  return (a+b)/2

ans=list[0]

for i in range(n-1):
  ans=mazemaze(ans,list[i+1])

print(ans)

Submission status: Accepted

Solution code:
n=int(input())-1
d=sorted(list(map(int,input().split())))
for i in range(0,n):d[1]=sum(d[:2])/2;d.pop(0)
print(d[0])

Submission status: Accepted

Solution code:
n=int(input())-1
d=sorted(list(map(int,input().split())))
for i in range(0,n):
    d[1]=sum(d[:2])/2
    d.pop(0)
print(d[0])

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())
v = [int(i) for i in input().split()]
v.sort(reverse=True)
ans = 0
for i in range(n-1):
    ans += 2 ** (n-2-i) * v[i]
ans = (ans + v[-1]) / 2 ** (n-1)

print(ans)

Submission status: Accepted

Solution code:
import heapq

n = int(input().strip())
v = list(map(int, input().split()))
heapq.heapify(v)

while (1 < len(v)):
    heapq.heappush(v, (heapq.heappop(v) + heapq.heappop(v)) / 2)

print(v[0])

Submission status: Accepted

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

n = int(input())
guzai_valu = list(map(int, input().split()))
heikin=0
i=1
while i <= n-1:
   guzai_valu_sort = sorted(guzai_valu)
   #print(guzai_valu_sort)
   heikin=(guzai_valu_sort.pop(0)+guzai_valu_sort.pop(0))/2
   guzai_valu_sort.append(heikin)
   guzai_valu = guzai_valu_sort
   i=i+1
print(heikin)


'''自動で成分がずれるのでリスの成分の内最初のものを2回選ぶことが最小のもの
   を2つ選ぶことと等価になるんや
   #print(heikin)'''

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
v = list(map(int, input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

v_sort = list(sorted(v))

while len(v_sort) > 1:
    A = v_sort.pop(0)
    B = v_sort.pop(0)
    new = 0.5 * (A + B)
    v_sort.append(new)
    v_sort = list(sorted(v_sort))

print(v_sort[0])

Submission status: Accepted

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

while len(v) != 1:
    v.sort(reverse=True)
    a = v.pop()
    b = v.pop()
    v.append((a + b) / 2)
print(v[0])

Submission status: Accepted

Solution code:
N = int(input())
v = sorted(list(map(int, input().split())), reverse=True)
ans = 0
tw = 2
for i in range(len(v) - 1):
    ans += v[i] * 0.5 ** (i + 1)
print(ans + v[-1] * 0.5 ** (len(v) - 1))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
v = [int(i) for i in input().split()]
v.sort()
ans = 0
for j in range(0,n-1):
    if(j==0):
        ans = (v[j]+v[j+1])/2
    else:
        ans = (ans + v[j+1])/2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = [int(i) for i in input().split()]
v.sort()
ans = (v[0] + v[1]) / 2
if n == 2: print(ans)
else:
    for i in range(1, n-1):
        ans  = (ans + v[i+1]) / 2
    print(ans)

Submission status: Accepted

Solution code:
import heapq

n = int(input())
v = [int(_) for _ in input().split()]

heapq.heapify(v)
while len(v) > 1:
    h = (heapq.heappop(v) + heapq.heappop(v)) / 2
    heapq.heappush(v, h)

print(v[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import heapq

N=int(input())
V=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき

heapq.heapify(V)
a=heapq.heappop(V)
b=0
for i in range(len(V)):
    b=heapq.heappop(V)
    a=(a+b)/2

print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# ABC138C

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

while len(v) > 1:
    v.sort(reverse=True)
    a = v.pop()
    b = v.pop()
    v.append((a + b) / 2)

res = v.pop()
if res.is_integer():
    res = int(res)
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import heapify, heappop, heappush

N=int(input())
V=[int(v) for v in input().split()]
V.sort()
heapify(V)

for _ in range(N-1):
  heappush(V, (heappop(V)+heappop(V))/2)

print(heappop(V))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
tmplist = v
tmplist.sort()
while len(tmplist) != 1:
    mix = ( tmplist.pop(1) + tmplist.pop(0) ) / 2 # ここはpop()する順番が重要
    tmplist.append(mix)
    tmplist.sort()
else:
    print(tmplist[0])

Submission status: Accepted

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

Submission status: Accepted

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

vn.sort()
sumV = vn[0]

for v in vn[1:]:
    sumV = (sumV + v)/2
print(sumV)

Submission status: Accepted

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

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

v.sort()

ans = 0
if n == 1:
    print(v[0])
else:
    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()
s = v[0]
for i in range(1,n):
    s = (s + v[i])/2 
print(s)

Submission status: Accepted

Solution code:
n = int(input())
list = list(map(int, input().split()))
list.sort()
list2 = [list[0]]
for i in range(1,n):
    list2.append(list[i] * 2 ** (i-1))

print(sum(list2) / 2 ** (n-1))

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(0, N-1):
    tmp = (V.pop(0) + V.pop(0)) / 2
    V.append(tmp)
    V.sort()

print(V[0])

Submission status: Accepted

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

v.sort()

sum = v[0]

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

Submission status: Accepted

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


for i in range(0, n-1):
    min1 = min(v)
    v.remove(min1)
    min2 = min(v)
    v.remove(min2)
    fusion = (min1 + min2) / 2
    v.append(fusion)


print(v[0])

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    # input
    n = int(input())
    v = list(map(int, input().split()))
    v.sort()
    ans = 0
    for num, i in enumerate(v):
        if num<2:
            ans += i/2**(n-1)
        else:
            ans += i/2**(n-num)

    # calc
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
V = list(map(int, input().split()))
V.sort()
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 = sorted(list(map(int,input().split())),reverse = True)
ans = 0
for i in range(len(v)-1):
    ans += v[i]/2**(i+1)
ans += v[-1]/2**(len(v)-1)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int,input().split()))
v.sort()
if len(v)==1:
    print(v[0])
elif len(v)==2:
    print((v[0]+v[1])/2)
else:
    s=(v[0]+v[1])/2
    for j in range(2,N):
        s=(s+v[j])/2
    print(s)

Submission status: Accepted

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

Submission status: Accepted

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

sortedv = sorted(v)

#w1 = (sortedv[1]+sortedv[2])/2
ans = sortedv[0]
for i in range(n):
    ans = (ans+sortedv[i])/2

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = [int(v) for v in 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:
import numpy as np
n = int(input())
v = np.array(list(map(float, input().split())))
v.sort()

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

Submission status: Accepted

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

def mix(v):
  l1 = min(v)
  v.remove(l1)
  l2 = min(v)
  v.remove(l2)
  v.append((l1+l2)/2)
  
for i in range(N-1):
  mix(v)
  
print(*v)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    v = [int(x) for x in input().split()]
    temp = 0
    v = sorted(v)
    for i in range(n-1):
        if i == 0:
            temp = (v[i]+v[i+1])/2
            continue
        temp = (temp+v[i+1])/2
    print(temp)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N  = int(input())
v =  sorted(list(map(int, input().split())))
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())
values=[int(i) for i in input().split()]
values.sort()

ans=values[0]
for i in range(1,n):
    ans+=(2**(i-1))*values[i]

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

Submission status: Accepted

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

for vv in v:
    ans = (ans + vv)/2

print(ans)

Submission status: Accepted

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

v_list.sort()

score = v_list[0]
for v in v_list[1:]:
    score = (score + v)/2

print(score)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
y = [int(i) for i in input().split()]

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

Submission status: Accepted

Solution code:
import itertools
n = int(input())
a = list(map(int, input().split()))
a.sort()
start = 2 ** (len(a) - 1)

ans = a[0] / start
for v in a[1:]:
    ans += v / start
    start //= 2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
x=list(map(int,input().split()))
ans=0
a=min(x)
x.remove(min(x))
b=min(x)
x.remove(min(x))
ans+=(a+b)/2
while len(x)>0:
    c=min(x)
    ans=(ans+c)/2
    x.remove(min(x))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

V_sorted=sorted(V)

now_value=(V_sorted[0]+V_sorted[1])/2
for i in range(2,N):
    now_value=(now_value+V_sorted[i])/2

print(now_value)

Submission status: Accepted

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

for i in range(N - 1):
	p = (w.pop(0) + w.pop(0)) / 2
	w.insert(0, p)

print(w[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
seq = sorted((int(x) for x in input().split()))
cur_val = seq[0]
for i in range(n-1):
	cur_val = (cur_val + seq[i+1]) / 2
print(cur_val)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq
N = int(input())
V = list(map(int, input().split()))
heapq.heapify(V)
while len(V) > 2:
    min_ = heapq.heappop(V)
    second_min = heapq.heappop(V)
    heapq.heappush(V, (min_+second_min)/2)
else: print((V[0] + V[1]) / 2)

Submission status: Accepted

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

lists.sort()

for i in range(n - 1):
    lists.insert(0, (lists.pop(0) + lists.pop(0))/2)

print(lists[0])

Submission status: Accepted

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


import heapq

heapq.heapify(V_list)


for i in range(N-1):
        v1=heapq.heappop(V_list)
        v2=heapq.heappop(V_list)
        new_v = (v1+v2)/2
        heapq.heappush(V_list,new_v)





print(V_list[0])

Submission status: Accepted

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

v.sort()

while len(v) != 1:
    a = v.pop(0)
    b = v.pop(0)
    v.insert(0, (a+b)/2)

print(v[0])

Submission status: Accepted

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

v_list.sort(reverse=True)

while len(v_list) > 1:
  v_1 = v_list.pop()
  v_2 = v_list.pop()
  new = (v_1 + v_2) /2
  v_list.append(new)
  v_list.sort(reverse=True)
print(v_list[0])

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
import heapq
heapq.heapify(a)
for i in range(N-1):
  x = heapq.heappop(a)
  y = heapq.heappop(a)
  z = (x+y)/2
  heapq.heappush(a,z)
answer = heapq.heappop(a)
print(answer)

Submission status: Accepted

Solution code:
#input
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
    V[i] = 0

print(V[len(V)-1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def t(v):
    v.sort()
    while len(v) > 1:
        v[0] = (v[0] + v.pop(1)) / 2
    return v[0]


if __name__ == '__main__':
    n = input()
    v = list(map(int, input().split()))
    print(t(v))

Submission status: Accepted

Solution code:
from collections import deque

N=int(input())
Value=deque(sorted(list(map(int, input().split()))))

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

print(Value.pop())

Submission status: Accepted

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

v.sort(reverse=True)
x = 1
answer = 0
for i in range(N-1):
    x *= 2
    answer += (v[i]/x)

answer += v[N-1]/x
print(answer)

Submission status: Accepted

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

for i in range(N-1):
	min1 = min(v)
	v.remove(min1)
	min2 = min(v)
	v.remove(min2)
	a = (min1 + min2) / 2
	v.append(a)
print(v[0])

Submission status: Accepted

Solution code:
N=int(input())
V=sorted(map(int,input().split()),reverse=True)
ans=V[-1]*0.5**(N-1)
for i in range(1,N):
    ans+=V[i-1]*0.5**i
print(ans)

Submission status: Accepted

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

v.sort()
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 = list( map(int, input().split(" ")) )

v = sorted(v)

for i in range(1, N):
    v[i] = (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()

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

print (ans)

Submission status: Accepted

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

v.sort()

sum = v[0]

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

print(sum)

Submission status: Accepted

Solution code:
N = int(input())

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

A = sorted(A)

for index in range(N - 1):
    a = A[index]
    b = A[index + 1]
    A[index + 1] = (a + b) / 2

print(A[N - 1])

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from heapq import heappop,heappush,heapify

N,*V = map(int,read().split())

heapify(V)

while len(V) >= 2:
    x = heappop(V); y = heappop(V)
    heappush(V,(x+y)/2)

answer = V[0]
print(answer)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    values = sorted([int(n) for n in input().split()], reverse=True)
    ret = 0
    while len(values) > 1:
        tmp = (values[-1] + values[-2]) / 2
        del values[-1]
        values[-1] = tmp
    print(values[0])

Submission status: Accepted

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

v.sort()

sum = 0

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

print(sum)

Submission status: Accepted

Solution code:
n = int(input())
l = [int(x) for x in input().split()]
l.sort()
res = l[0];

for i in l:
	res = (res+i)/2
print (res)

Submission status: Accepted

Solution code:
n = int(input())
num_list = list(map(int, input().split()))
num_list.sort(reverse=True)
ans = 0

for i in range(n-1):
  ans += num_list[i] / 2**(i+1)

ans += num_list[n-1] / 2**(n-1)
print(ans)

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

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

s_Vi = sorted(Vi)

i = 1

while i < N:
    s_Vi2 = s_Vi[2:]
    s_Vi2.append(sum(s_Vi[:2])/2)
    s_Vi = sorted(s_Vi2)
    i += 1

print(s_Vi[0])

Submission status: Accepted

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

vlist.sort(reverse=True)
while(len(vlist)>1):
  v1=vlist.pop()
  v2=vlist.pop()
  v=1.0*(v1+v2)/2
  vlist.append(v)
  vlist.sort(reverse=True)
  
print(vlist[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=sorted(list(map(int,input().split())))
s=V[0]/(2**(N-1))
for i in range(1,N):
    s+=V[i]/(2**(N-i))
print(s)

Submission status: Accepted

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

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

print(Value)

Submission status: Accepted

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

print(sum)

Submission status: Accepted

Solution code:

if __name__ == '__main__':
    n = int(input())
    Arrnums = sorted([float(x) for x in input().split(' ')])
    j = 1
    q = Arrnums[0]
    for i in range(j, n):
        q = (Arrnums[i] + q)/2

    print(q)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq

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

# v[0] <= v[1] <= ...<= v[N]となるように並べ替えた時、
# ( v[0] + v[1] + 2 * v[2] + ... + 2^(i-1) * v[i] + ... + 2^(N-2) * v[N-1] ) / 2^(N-1)
# が最大値

heapq.heapify(v)
sum = heapq.heappop(v)

for i in range(1, N):
    sum += 2 ** (i - 1) * heapq.heappop(v)

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

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(map(int, input().split()))

import numpy as np

n = ii()
v = li()

x = sorted(v)

for i in range(n):
    if i>1:
        x[i] = x[i]*(2**(i-1))

print(sum(x)/(2**(n-1)))

Submission status: Accepted

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

import heapq

heapq.heapify(v)

for i in range(N-1):
  a = heapq.heappop(v)
  b = heapq.heappop(v)
  heapq.heappush(v, (a+b)/2)
print(v[0])

Submission status: Accepted

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

Submission status: Accepted

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

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

print(to)