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

Submission status: Accepted

Solution code:
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:
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:
import heapq

N = int(input())
V = [int(a) for a in input().split()]
h = []
for v in V:
    heapq.heappush(h, v)

for i in range(N-1):
    heapq.heappush(h, (heapq.heappop(h) + heapq.heappop(h)) / 2)

print(heapq.heappop(h))

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
V = LIST()
V.sort()
a = V[0]
for i in range(N-1):
    a = (a + V[i+1]) / 2
print(a)

Submission status: Accepted

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

print(com)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
# from fractions import gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def ave(L):
    if len(L) == 1: return L[0]
    elif len(L) == 2: return (L[0] + L[1]) / 2
    else: return (L[0] + ave(L[1:len(L)])) / 2
    


def main():
    N = INT()
    V = LIST()
    
    V = sorted(V, reverse=True)
    print(ave(V))


if __name__ == '__main__':
        main()

Submission status: Accepted

Solution code:
import sys
import 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
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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
V = LIST()

V = list(sorted(V))
V = [float(v) for v in V]


def sum_func(V):
    return (V[0] + V[1]) / 2


while True:
    if len(V) == 1:
        print(V[0])
        break
    else:
        V = [sum_func(V)] + V[2:]

Submission status: Accepted

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

v = sorted(v)

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

print(x)

Submission status: Accepted

Solution code:
# C
import heapq # 優先度付きキュー(最小値取り出し)
n = int(input())
v = list(map(int, input().split()))
heapq.heapify(v)   # ヒープ化
ans = 0
for i in range(n-1):
    tmp1 = heapq.heappop(v)               # 最小値の取り出し
    tmp2 = heapq.heappop(v)               # 最小値の取り出し
    tmp = (tmp1 + tmp2) / 2
    heapq.heappush(v, tmp)
ans = heapq.heappop(v)               # 最小値の取り出し
print(ans)

Submission status: Accepted

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

V.sort()

while(len(V) > 1):
    v1 = V.pop(0)
    v2 = V.pop(0)
    V.insert(0, (v1+v2)/2)
print(V[0])

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

while len(v)>=2:
    x=min(v)
    v.remove(min(v))
    y=min(v)
    v.remove(min(v))
    v.append((x+y)/2)
print(sum(v))

Submission status: Accepted

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

a=a[0]
p = 0
a=a-1

b.sort()
for i in range(a):
	p=(b[i]+b[i+1])/2
	b[i+1]=p

print(b[a])

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:
def main():
    n=int(input()) 
    V=sorted(map(int,input().split()))
    ans = 0
    for i,v in enumerate(V):
        ans += v/2**min(n-1,n-i)
    print(ans)
main()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
#!/usr/bin/env python
# coding: utf-8

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def main():
    n = ri()
    lv = rli()
    lv.sort()
    ans = lv[0]
    for i in range(1, n):
        ans = (ans+lv[i])/2
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

for v in range(N-1):
    V.sort()
    min1 = V.pop(0)
    min2 = V.pop(0)
    new = (min1 + min2) / 2
    V.append(new)

print(V[0])

Submission status: Accepted

Solution code:
n=int(input()) 
lst=list(map(int,input().split()))
lst.sort()
#print(lst) 
a=[] 

for i in range(n): 
	if i==0: 
		#print(lst[i]) 
		a.append(lst[i]) 
	else: 
		#print(lst[i]) 
		a.append((a[-1]+lst[i])/2)   
print(a[-1])

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]

for i in range(n - 1):
    pot = []
    pot.append(min(a))
    a.pop(a.index(min(a)))
    pot.append(min(a))
    a.pop(a.index(min(a)))
    a.append(sum(pot)/2)

print(*a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
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:
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:
n = int(input())
v = [int(x) for x in input().split()]

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

print(x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while True:
    if len(v)==1:
        break
    tmp = (v[0]+v[1])/2
    v.append(tmp)
    v.remove(v[0])
    v.remove(v[0])
    v.sort()
print(*v)

Submission status: Accepted

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

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

while len(value) > 1:
    value.append((value.pop()+value.pop()) / 2)

print(value[0])

Submission status: Accepted

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

v.sort()
while True:
    if len(v) > 1:
        new = (v.pop(0)+v.pop(0))/2
        v.append(new)
        v.sort()
    else:
        break

print(v[0])

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 permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

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()))
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:
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    N = int(input())
    V = list(map(int, input().split()))

    while len(V) != 1:
        V.sort()
        v1, v2 = V.pop(0), V.pop(0)
        V.append((v1 + v2) / 2)

    print(*V)


if __name__ == "__main__":
    main()

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

while len(V)> 1:
  a = min(V)
  V.pop(V.index(a))
  b = min(V)
  V.pop(V.index(b))
  V.append((a+b)/2)
print(V[0])

Submission status: Accepted

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

v_ls.sort()
first = v_ls[0]
ind = 1
while ind < n:
    first = (first + v_ls[ind]) / 2
    ind += 1
print(first)

Submission status: Accepted

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

V.sort()

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect
import numpy as np
input = sys.stdin.readline
MOD = 10**9 + 7
INF = float('INF')

def main():
    n = int(input())
    v = list(map(float,input().split()))
    v = np.array(v)
    v.sort()

    for i in range(n, 1, -1):
        v[:i] = v[:i] * 0.5

    ans = sum(v)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int, input().split()))
v.sort()
i=0
while True:
    if len(v)<2:
        break
    buf=(v[0]+v[1])/2
    v=v[2:]
    v.insert(0,buf)
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 v:
   ans = (ans + i) / 2
print(ans)

Submission status: Accepted

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

w = v[:]
while len(w) > 1:
    w.sort()
    w.append((w.pop(0)+w.pop(0))/2)

print(w[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:
from functools import reduce
n = int(input())
v = map(int, input().split())

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

Submission status: Accepted

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

V_s = sorted(V)
res = V_s[0]
for i in range(N-1):
    res = (res+V_s[i+1])/2.0
print(res)

Submission status: Accepted

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

l.sort()
result=l[0]

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

print(result)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(v[-1])

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:
from collections import deque

N = int(input())
s = list(map(int, input().split()))
s.sort()
s = deque(s)
gosei = 0
i = 0
while len(s) > 1:
    x = s.popleft()
    y = s.popleft()
    gosei = (x + y) / 2
    s.appendleft(gosei)
print(gosei)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  Vs = list(map(int, input().strip().split()))
  Vs.sort()
  sum = Vs[0]
  for V in Vs[1:]:
    sum += V
    sum /= 2
  print(sum)

if __name__=='__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	k = 0
	n = len(l)
	l = sorted(l)
	while(k < n-1):
		ans = l[0] + l[1]
		zz = ans/2
		l.pop(0)
		l.pop(0)
		l.insert(0,zz)
		k += 1
	return round(l[0],10)

N = int(stdin.readline())
l = list(map(int, stdin.readline().rstrip().split()))
ans = solve(l)
print("%10f"%ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def main():
    N = int(input())
    v = list(map(int,input().split()))
    while len(v)>1:
        v.sort()
        v1 = v.pop(0)
        v2 = v.pop(0)
        v.append((v1+v2)/2)
    print(v[0])

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import itertools

# import numpy as np

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

N, *H = map(int, read().split())
H.sort(reverse=True)
while len(H) > 1:
    x = H.pop()
    y = H.pop()
    H.append((x+y)/2)
print(H[0])

Submission status: Accepted

Solution code:
import sys
import itertools

# import numpy as np

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

N, *H = map(int, read().split())
cnt = 1
H.sort()
ans = H[0]
for i in H[1:]:
    ans += cnt * i
    cnt *= 2
print(ans / cnt)

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:
import functools as fu
n = int(input())
v = list(map(int, input().split()))
v.sort()
print(fu.reduce(lambda x,y: (x+y)/2, v))

Submission status: Accepted

Solution code:
n=int(input())

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

t.sort()

res = t[0]

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

Submission status: Accepted

Solution code:
#python3
from collections import deque
def f(x, y):
    return (x+y)/2

def main():
    n = int(input())
    v = [int(i) for i in input().split()]
    while len(v) > 1:
        v.sort()
        a = v.pop(0)
        b = v.pop(0)
        v.append(f(a, b))
    print("{0:.12f}".format(v[0]))
main()

Submission status: Accepted

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

ans = v[:]

for i in range(n - 1):
    ans = sorted(ans)
    s = (ans[0] + ans[1]) / 2
    ans.pop(0)
    ans[0] = s

print(ans[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:
import heapq as q
N = input()
v = [int(x) for x in input().split()]
q.heapify(v)
while len(v) != 1:
    q.heappush(v, (q.heappop(v) + q.heappop(v)) / 2)
print(v[0])

Submission status: Accepted

Solution code:
import sys

n, *v = map(int, sys.stdin.read().split())

def main():
    v.sort(reverse=True)
    res = 0
    for i in range(n-1):
        res += v[i] / 2 ** (i + 1)
    res += v[-1] / 2 ** (n - 1)
    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

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

V.sort()

s=(V[0]+V[1])/2

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

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

sum = (l[0] + l[1])/2

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

print(v[-1])

Submission status: Accepted

Solution code:
N=int(input())
gu=list(map(int,input().split()))
gu.sort()
ans=[]
cnt=2
k=(gu[0]+gu[1])/2
while cnt<=N-1:
        k=(k+gu[cnt])/2
        cnt+=1
    
print(k)

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

result = v[0]

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

print(result)

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_lst = list(map(int,input().split()))
v_lst.sort()
new_value = v_lst[0]

for i in range(1,n):
    value1 = v_lst[i]
    new_value += value1
    new_value /= 2

print(new_value)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

# V を昇順にソートする
V_asc = sorted(V)

# 係数 (2**N-1) * V[i] の和を求める
sum_coef_v = 0
for i in range(N):
  coef = 2 ** (i-1)
  if i == 0: coef = 1
  sum_coef_v += coef * V_asc[i]

ans = sum_coef_v / (2 ** (N-1))
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
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()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
v = LIST()

for i in range(N - 1):
	v = sorted(v)
	mix = (v.pop(0) + v.pop(0))/2
	v.insert(0, mix)
print(v[0])

Submission status: Accepted

Solution code:
N = int(input())
M = list(map(int,input().split()))
X = sorted(M)
c = 0
for i, v in enumerate(X):
    if i >= N-1:
        break
    else:
        a = X[i]+X[i+1]
        b = a/2
        X[i+1]= a/2

print(b)

Submission status: Accepted

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

V.sort()
ans = (V[0] + V[1]) / 2
for i in range(2, N, 1):
    if i == N:
        break
    ans = (ans + V[i]) / 2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

while len(V) >= 2:
    V.sort(reverse=True)
    x = V.pop()
    y = V.pop()
    V.append((x+y)/2)
print(*V)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
  n=int(input())
  w=sorted(map(int,input().split()))
  ans=(w[0]+w[1])/2
  for i in range(2,n):
    ans=ans/2+w[i]/2
  print(ans)
if __name__=="__main__":
  main()

Submission status: Accepted

Solution code:
def main():
  import sys
  from collections import deque
  n=int(input())
  v=list(map(int,sys.stdin.read().split()))
  w=deque(sorted(v))
  ans=(w.popleft()+w.popleft())/2
  for i in range(n-2):
    ans=ans/2
    ans+=w.popleft()/2
  print(ans)
if __name__=="__main__":
  main()

Submission status: Accepted

Solution code:
def main():
  import sys
  n=int(input())
  w=list(map(int,sys.stdin.read().split()))
  #w=sorted(v,reverse=False)
  w.sort()
  ans=(w[0]+w[1])/2
  for i in range(2,n):
    ans=max(ans,ans/2+w[i]/2)
  print(ans)
  
if __name__=="__main__":
  main()

Submission status: Accepted

Solution code:
def main():
  import sys
  n=int(input())
  v=list(map(int,sys.stdin.read().split()))
  w=sorted(v,reverse=False)

  ans=(w[0]+w[1])/2
  for i in range(2,n):
    ans=max(ans,ans/2+w[i]/2)
  print(ans)
  
if __name__=="__main__":
  main()

Submission status: Accepted

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

  a=(w[0]+w[1])/2
  for i in range(2,n):
    a=max(a,a/2+w[i]/2)
  print(a)
  
if __name__=="__main__":
  main()

Submission status: Accepted

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

  ans=(w[0]+w[1])/2
  for i in range(2,n):
    ans=max(ans,ans/2+w[i]/2)
  print(ans)
  
if __name__=="__main__":
  main()

Submission status: Accepted

Solution code:
def main():
  import sys
  n=int(input())
  v=list(map(int,input().split()))
  w=sorted(v,reverse=False)

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

Submission status: Accepted

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

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

print(a[-1])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import heappush, heappop

N = int(input())
q = []

for i in map(int, input().split()):
    heappush(q, i)

for _ in range(N-1):
    a = heappop(q)
    b = heappop(q)
    c = (a+b)/2
    heappush(q, c)

ans = heappop(q)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split()))
V.sort(reverse=True)
while len(V)>=2:
    a = V.pop()
    b = V.pop()
    V.append((a+b)/2)
print(V[0])

Submission status: Accepted

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

v.sort()

s=0
for i in range(0,N):
    if i==0:
        s=s+v[0]
    else:
        s=s+v[i]*(2**(i-1))
print('{:.5g}'.format(s/(2**(N-1))))

Submission status: Accepted

Solution code:
N = int(input())

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

v.sort()
ans = v[0]
for x in v[1:]:
  ans = (ans + x ) / 2

print(ans)

Submission status: Accepted

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

l.sort()
ans = (l[0]+l[1])/2

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
v=sorted(list(map(int,input().split())),reverse=True)
ans=v.pop()
while len(v)>=1:
    ans=(ans+v.pop())/2
print(ans)