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:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

v.sort()

x=(v[1]+v[0])/2
if n>=3:
    for i in range(2,n):
        x=(v[i]+x)/2
    
print(x)

Submission status: Accepted

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

vs = sorted(v)

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


print(v_pair)

Submission status: Accepted

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

newa = sorted(a)
ans = newa[0]

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

print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(200000)
input = sys.stdin.readline


def read():
    N = int(input().strip())
    V = map(int, input().strip().split())
    return N, V
    

def solve(N, V):
    V = list(sorted(V))
    ans = V[0]
    for v in V:
        ans = (ans + v) / 2
    return ans


if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))

Submission status: Accepted

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

for i in range(len(v)):
    if i == 0:
        a = v[i]
    else:
        a = (a+v[i])/2
print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(input())
#S.remove("\n")
#N,M = map(int,input().split())
#S,T = map(str,input().split())
#A = [int(input()) for _ in range(N)]
#S = [input() for _ in range(N)]
#A = [list(map(int,input().split())) for _ in range(N)]
#import itertools
#import heapq
#import numpy as np
#INF = float("inf")
N = int(input())
A = list(map(int,input().split()))
A.sort()
s = A[0]
for i in range(1,N):
    s = (s+A[i])/2
print(s)

Submission status: Accepted

Solution code:
N=int(input())
V=[int(i) for i in input().split(" ")]
V.sort()
for i in range(N-1):
    V[1]=(V[0]+V[1])/2
    del V[0]
print(V[0])

Submission status: Accepted

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

while len(A) > 1:
    A = sorted(A)
    x = A[0]
    y = A[1]
    del A[0:2]
    A.append((x+y)/2)

print(A[0])

Submission status: Accepted

Solution code:
N = int(input())
*v, = map(int, input().split())
for _ in range(N - 1):
    min_v = min(v)
    v.remove(min_v)
    min_v_2 = min(v)
    v.remove(min_v_2)
    v.append((min_v + min_v_2) / 2)
print(*v)

Submission status: Accepted

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

v_n = sorted(v_n)

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

print(res)

Submission status: Accepted

Solution code:
N = int(input())
v = sorted(list(map(int, input().split())))
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 = list(map(int, input().split()))
value = 0

v.sort()
v.reverse()

for i in range(1, N):
  if i < N-1:
    value += v[i-1] / (2**i)
  else:
    value += (v[i-1] + v[i]) / (2**i) 

print(value)

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:
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
mix = lambda x:list(li() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(n,v):
    v = sorted(v)
    res = (v[0]+v[1])/2
    for i in range(2, n):
        res = (res + v[i]) / 2
    print(res)

n = ii()
v = mi()
main(n,v)

Submission status: Accepted

Solution code:
import sys
import math
from collections import Counter
import itertools
import fractions
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################
 
N=II()
V=LI()
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.sort()
v.reverse()
while(len(v)>1):
    v.append((v.pop()+v.pop())/2.0)
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()
max_v = v[0]
for i in range(n-1):
    max_v = (max_v + v[i+1]) / 2
print(max_v)

Submission status: Accepted

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

vals = sorted(vals)

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

Submission status: Accepted

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

Submission status: Accepted

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

N = INT()
v = LIST()
v.sort()
ans = v[0]

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

N = INT()
v = LIST()
v.sort()

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

print(ans)

Submission status: Accepted

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



n = N -2

while n >= 0:
  n += -1
  V.sort()
  result = (V[0] + V[1])/2
  del V[0:2]
  V.append(result)
 
  
print(result)

Submission status: Accepted

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

Submission status: Accepted

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


for i,v in enumerate(V):
  if i==0:
    ave=v
  else:
    ave=(ave+v)/2
    
print(ave)

Submission status: Accepted

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

b = a / (2 ** (n - 1))
print(b)

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

Submission status: Accepted

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

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

print(temp)

Submission status: Accepted

Solution code:
#ABC138_C
#大きい数字を残して小さい数字通しを混ぜて行けば良い
n=int(input())
arr=list(map(int,input().split()))
while len(arr)>1: #最後の1つになるまで操作を続ける
 arr=sorted(arr) #配列を昇順ソート
 v1=arr.pop(0) #最小の2数を取り出し、それらを合成したものを配列に追加する
 v2=arr.pop(0)
 arr.append((v1+v2)/2)
print(arr[0])

Submission status: Accepted

Solution code:
from decimal import Decimal

n = int(input())

v = [0] * n

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

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

Submission status: Accepted

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

print(sum(v)+v[0])

Submission status: Accepted

Solution code:
n=int(input())
# sum1=
arr=list(map(int,input().split()))
arr.sort()
arr.reverse()
from collections import deque 
st = deque()
for i in arr:
  st.append(i)
while(len(st)!=1):
    x=st.pop()
    y=st.pop()
    st.append((x+y)/2)
print(st.pop())

Submission status: Accepted

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

Submission status: Accepted

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

list.sort()
while len(list) > 1:
    # print(list)
    list.sort()
    x = (list[0] + list[1]) / 2.0
    list.append(x)
    del list[:2]
print('{:.08f}'.format(list[0]))

Submission status: Accepted

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

a = 0
lis = []

while n-1 != 0:
  for i in range(2):
    lis.append(min(l))
    l.remove(min(l))
  a = sum(lis)/2
  del lis[:]
  l.append(a)
  n-=1
print(a)

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

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())
A = list(map(int, input().split()))
A.sort()
while len(A)>=2: 
    X = (A[0]+A[1])/2
    A.pop(0)
    A.pop(0)
    A.append(X)
    A.sort()
else:
    print(A[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

v.sort()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
ans=0
v.sort()
ans=(v[0]+v[1])/2
del v[:2]
while v!=[]:
    ans=(ans+v[0])/2
    del v[0]
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):
    ans = (ans + v[i])/2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int, input().split()))
for _ in range(n-1):
  li.sort(reverse=True)
  a = li.pop()
  b = li.pop()
  li.append((a+b)/2)
print(*li)

Submission status: Accepted

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

A = v[0]

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

Submission status: Accepted

Solution code:
def resolve():
    n=int(input())
    l=list(map(int, input().split()))
    l.sort()
    while len(l)>=2:
        a=(l[0]+l[1])/2
        l.pop(1)
        l.pop(0)
        l.append(a)
        l.sort()
    print(l[0])
resolve()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# C - Alchemist

n = int(input())
v = list(int(x) for x 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:
n = int(input())
v = list(map(int,input().split()))
while len(v)!= 1:
    v.sort()
    v.append((v[0]+v[1])/2)
    v = v[2:]
print(v[0])

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
n = int(input())
v = list(map(float, 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 heapq
n=int(input())
s=list(map(int,input().split()))
heapq.heapify(s)
while len(s)!=1:
    a=heapq.heappop(s)
    b=heapq.heappop(s)
    heapq.heappush(s,(a+b)/2)
print(heapq.heappop(s))

Submission status: Accepted

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



main()

Submission status: Accepted

Solution code:
#入力
N = int(input())
v = list(map(int,input().split()))
#小さい数順に並び替え
V = sorted(v)
#合計値をsumとする
sum = 0
#手で解いてみると、数が大きいものほど後から足した方が合計が大きいことが分かる。
if N >= 3:
  for i in range(N-1):
    sum += (2**(i))*V[i+1]/2**(N-1)
  sum += V[0]/2**(N-1)
#わざわざ場合分けしたがN>=3の時でもV[0]項を最後に分けて足しているので不要だったか?
elif N == 2:
  sum = (V[0]+V[1])/2
#結果
print(sum)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int,input().split()))
V = sorted(v)
sum = 0
if N >= 3:
  for i in range(N-1):
    sum += (2**(i))*V[i+1]/2**(N-1)
  sum += V[0]/2**(N-1)

elif N == 2:
  sum = (V[0]+V[1])/2

print(sum)

Submission status: Accepted

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

dct = sorted(v, reverse=False)

ans = 0
for i in range(N-1):
    if i == 0:
        ans = (dct[i] + dct[i+1]) / 2
    if i > 0:
        ans = ( ans + dct[i+1]) / 2
    
print(ans)

Submission status: Accepted

Solution code:
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()
v = LI()
vs = sorted(v)

def kati(x,y):
    return (x+y)/2

result = vs[0]
cv = 0
for i in range(1, n):
    result = kati(result, vs[i])

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

v.sort()
ans=float(v[0])
for i in range(1,n):
    ans=(ans+v[i])/2

print(ans)

Submission status: Accepted

Solution code:
import heapq
n = int(input())
v = list(map(int, input().split()))
heapq.heapify(v)
count = 0
ab = 0
while count < n-1:
    a = heapq.heappop(v)
    b = heapq.heappop(v)
    ab = (a+b)/2
    heapq.heappush(v, ab)
    count += 1

ans = ab
print(ans)

Submission status: Accepted

Solution code:
n,*v=map(int,open(0).read().split())
v=sorted(v)[::-1]
v1=v.pop()
v2=v.pop()
ans=(v1+v2)/2
while v:
  ans=(ans+v.pop())/2
print(ans)

Submission status: Accepted

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

sortedV=sorted(V)
while len(sortedV)>=2:
    new=(sortedV.pop(0)+sortedV.pop(0))/2
    sortedV.append(new)
    sortedV=sorted(sortedV)

print(*sortedV)

Submission status: Accepted

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

for i in range(n-1):
  ans+=m[i]*(0.5)**(i+1)
  
ans+=m[n-1]*0.5**(n-1)
  
print(ans)

Submission status: Accepted

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

h = sorted(H, reverse=True)
ans = h.pop()

for i in range(N-1):
    ans = (ans + h.pop())/2

print(ans)

Submission status: Accepted

Solution code:
from collections import deque

N = int(input())
H = deque(map(int, input().split()))

h = deque(sorted(H))

ans = h.popleft()
for i in range(N-1):
    ans = (ans + h.popleft())/2

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
for i in range(N-1):
  min1 = 0
  min2 = 0
  min1 = min(V)
  V.remove(min(V))
  min2 = min(V)
  V.remove(min(V))
  mix = 0
  mix = (min1+min2)/2
  V.append(mix)
print(*V)

Submission status: Accepted

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

b.sort()


def calc(x,y):
    return (x+y)/2


res=calc(b[0],b[1])


for i in range(2,n):
    res=calc(res,b[i])

print(res)

Submission status: Accepted

Solution code:

def calc(listv):
    total=0
    total += (listv[0]+listv[1])/2
    list_l=len(listv)
    i = 2
    while(list_l >2):
        total += listv[i]
        total /= 2
        list_l -= 1
        i+=1
    return total

n=int(input())
ans=0
v=list(map(int,input().split()))
v.sort()
"""
if n>2:
    for i in range(2,n):
        ans=(v[0]+v[1])*(2**(-n+1))+v[i]*(2**(-n+i))
else:
    ans=(v[0]+v[1])*(2**(-n+1))
"""
ans = calc(v)
if ans-int(ans)==0:
    print(int(ans))
else:
    print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    v = sorted(list(map(int,input().split())))
    ans = 0
    for i in range(n):
        if i==0 or i==1:
            ans += v[i]*(0.5)**(n-1)
        else:
            ans += v[i]*(0.5)**(n-i)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
v_list = list(map(int, input().split()))
v_list.sort()
ans = 0
ans = (v_list[0] + v_list[1]) / 2
if len(v_list) != 2:
    for v in v_list[2:]:
        ans = (v + ans) / 2
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
L=list(map(int,input().split()))
L.sort()
score=-1
for i in L:
  if score==-1:
    score=i
    continue
  score=(score+i)/2
print(score)

Submission status: Accepted

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

v.sort()

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

Submission status: Accepted

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

v = sorted(v)

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

print(v[0])

Submission status: Accepted

Solution code:
n = int(input())
lst = []
s = input().rstrip().split(' ')
for j in range(n):
  lst.append(int(s[j]))
lst.sort()
for i in range(n-2):
  temp = (lst[0] + lst[1]) /2
  del lst[1]
  del lst[0]
  lst.append(temp)
  lst.sort()
ans = (lst[0] + lst[1]) / 2
print(ans)

Submission status: Accepted

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

v.sort()
value = 0
for i, x in enumerate(v):
    if i < 2:
        value += x
    else:
        value += x * (2 ** (i - 1))
print(value / 2 ** (len(v) - 1))

Submission status: Accepted

Solution code:
# 初期入力
N = int(input())
V = list(map(int, input().split()))
V.sort()

#小さい順足してみる
sum_heikin=0
for i in range(N-1):
    V[i+1] = (V[i+1] +V[i])/2
print(V[i+1])

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    V = [int(v) for v in input().split()]
    V = sorted(V)
    val = (V[1]+V[0])/2.0
    for i in range(2, N):
        val = (val + V[i])/2.0
    print(val)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from functools import reduce

n = int(input())

v_list = [int(x) for x in input().split()]
v_list.sort()

ans = reduce(lambda a, b: (a + b) / 2, v_list)
print(ans)

Submission status: Accepted

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

S=sorted(S)
sum=0
for i in range(0,N-1):
  A=(S[0]+S[1])/2
  del S[0:2]
  S.insert(0,A)
  
print(S[0])

Submission status: Accepted

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

v.sort()
ave = (v[0] + v[1])/2

if n == 2:
  print(ave)
else:
  for i in range(2,n):
    ave = (ave + v[i])/2
  print(ave)

Submission status: Accepted

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


def saiki(n):
    m = ((n[0] + n[1]) / 2)
    n.pop(0)
    n.pop(0)
    n.insert(0, m)
    if (len(n) == 1):
        print(n[0])
        exit()
    saiki(n)


print(saiki(U))

Submission status: Accepted

Solution code:
n = int(input())
v_li = list(map(int,input().split()))
v_li.sort()
ans = 0
j = 2
for i,v in enumerate(v_li):
    if i<2:
        ans += v/2**(n-1)
    else:
        ans += v/2**(n-j)
        j += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import deque
N = int(input())
li = list(map(int, input().split()))
d = deque(sorted(li))
while len(d) != 1:
    x = d.popleft()
    y = d.popleft()
    temp = (x+y)/2
    d.appendleft(temp)
print(d[0])

Submission status: Accepted

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

v.sort()
ave = (v[0] + v[1])/2

if n == 2:
  print(ave)
else:
  for i in range(2,n):
    ave = (ave + v[i])/2
  print(ave)

Submission status: Accepted

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

Submission status: Accepted

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

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())
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:
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    v = list(map(int, input().split()))
    v.sort()
    ans = v[0]
    for i in range(1, len(v)):
        ans = (ans+v[i])/2
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

for i in range(N-1):
    k=min(v)
    v.remove(k)
    l=min(v)
    v.remove(l)
    new=(k+l)/2
    v.append(new)

print(*v)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int,input().split()))
v = sorted(v)
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 = list(map(int, input().split()))
v = sorted(v)
ans = v[0]
for i in v[1:]:
    ans = (ans + i) / 2
print(ans)

Submission status: Accepted

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

lv.sort()

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

print(lv[0])

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
v.sort(reverse=False)
#print(v)
ave = (v[0]+v[1])/2

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

Submission status: Accepted

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

v.sort()
# print(v)
w = []

w0 = (v[0] + v[1])/2
w.append(w0)

for i in range(1,n-1):
    y = (v[i+1] + w[i-1])/2
    w.append(y)
    # print(w)
# print(w)
print(w[n-2])

Submission status: Accepted

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

Submission status: Accepted

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

d = deque(sorted(v))

ans = 0
while len(d) > 1:
    ans = 0
    ans += d.popleft()
    ans += d.popleft()
    d.appendleft(ans / 2)
print(d.pop())

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())
U = list(map(int, input().split()))
U.sort()
ans = (U[0] + U[1]) /2
U.pop(0)
U.pop(0)
for i in range(len(U)):
    ans = (ans + U[0]) /2
    U.pop(0)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = sorted([int(v) for v in input().split()])
val = V[0]
for v in V[1:]:
    val = (val + v) / 2
print(val)

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 = (ans + values[i]) / 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-1]+v[i])/2

print(v[n-1])

Submission status: Accepted

Solution code:
n=int(input())
vs=sorted(map(int,input().split()))
ans=(vs[0]+vs[1])/2
for i,j in enumerate(vs):
  if i<2: continue
  ans=(ans+j)/2
print(ans)

Submission status: Accepted

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

v_sort = sorted(v)

v_value = v_sort[0]
for i in range(len(v)-1):
    v_value = (v_sort[i+1]+v_value) /2

print(v_value)