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 = sorted(v)
while len(v) > 1:
  a = v.pop(0)
  b = v.pop(0)
  v.append((a+b)/2)
  v = sorted(v)
  if len(v) == 1:
    break

print(*v)

Submission status: Accepted

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

v.sort()

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

print(v[0])

Submission status: Accepted

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

v = sorted(v)
vc = v.copy()
for i in range(1, N):
    vc[i] = (vc[i] + vc[i-1]) / 2

print(max(vc))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N = I()
    V = LI()
    V = sorted(V)
    cur = V[0]
    for i in range(1, len(V)):
        cur = (cur + V[i])/2
    print(cur)
        

main()

Submission status: Accepted

Solution code:
n = int(input())
li = sorted(list(map(int, input().split())))
r = li[0]
for i, j in enumerate(li):
    if i != 0:
        r = (r + li[i]) / 2
print(r)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

sorted_v = sorted(v)

upper_sum = sorted_v[0]
for i in range(1, N):
    upper_sum += sorted_v[i] * (2 ** (i - 1))

lower = 2 ** (N - 1)

ans = upper_sum / lower
print(ans)

Submission status: Accepted

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

V.sort()

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

print(res)

Submission status: Accepted

Solution code:
n = int(input())

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

for i in range(n-1):
    v = sorted(v)
    v1 = v.pop(0)
    v2 = v.pop(0)
    v.append((v1+v2)/2)

print(v[0])

Submission status: Accepted

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

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

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = II()
    vs = LI()
    vs = sorted(vs)
    ans = 0
    for i in range(n):
        if i == 0:
            ans += vs[i]
        else:
            ans = (ans + vs[i]) /2
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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


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

Submission status: Accepted

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

v = sorted(v)

while (len(v) > 1):
  comp = (v.pop(0) + v.pop(0)) / 2
  v.append(comp)
  v = sorted(v)

print(v[0])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
#ABC138C
import copy
import sys
import math

n = int(input())
tmp = input().split()
hoge = list(map(lambda a: int(a), tmp))

hoge.sort()

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

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

A.sort()
#print(A)

ans = (A[0]+A[1])/2.0
for n in range(2,N):
	ans = (ans+A[n])/2.0
print(ans)

Submission status: Accepted

Solution code:
n1 = int(input())

n2 = [int(i) for i in input().split()]

n2.sort()

s1 = n2[0]
for i1 in range(n1 - 1):
    s1 = (s1 + n2[i1 + 1]) / 2

print(s1)

Submission status: Accepted

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

v_ = sorted(v)

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

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

if ans % 1 == 0:
    ans = int(ans)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
V = [int(el) for el in input().split(' ')]
V = sorted(V)
total = V[0]
for i in range(1,n):
    total = (total + V[i]) / 2
print(total)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

for i in range(n-1):
    V[i+1] = V[i]+V[i+1]
    V[i+1] = V[i+1]/2
    # print(V)
print(V[-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] * (2 ** (i - 1))
print(ans / (2 ** (N - 1)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce


def main():
    n = int(input())
    v = map(int, input().split())
    v = sorted(v)

    ans = reduce(lambda acc, x: (acc + x) / 2, v[1:], v[0])
    print(ans)


main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ANS=A[0]
for a in A[1:]:
    ANS=(ANS+a)/2

print(ANS)

Submission status: Accepted

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

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

while(len(V)>1):
    V.sort()
    V.reverse()
    x = V.pop()
    y = V.pop()
    V.append((x+y)/2)
print(V[0])

Submission status: Accepted

Solution code:
import heapq

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

heapq.heapify(V)

for _ in range(N-1):
    x = heapq.heappop(V)
    y = heapq.heappop(V)
    heapq.heappush(V,(x+y)/2)

print(V[0])

Submission status: Accepted

Solution code:
import heapq


def solve(N, Vs):
    h = []
    for v in Vs:
        heapq.heappush(h, v)
    while len(h) >= 2:
        a = heapq.heappop(h)
        b = heapq.heappop(h)
        c = (a + b) / 2
        heapq.heappush(h, c)
    return h[0]


if __name__ == "__main__":
    N = int(input())
    Vs = list(map(int, input().split(" ")))
    print(solve(N, Vs))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
*V, = map(int, input().split())
V.sort()
c = V[0]
for i in range(1, N):
    c = (c + V[i]) / 2
print("%.16f" % c)

Submission status: Accepted

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

a=sorted(a, reverse=True)

ans=0

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

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

Submission status: Accepted

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

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

for i in v:
    print(i)

Submission status: Accepted

Solution code:
a=int(input())
b=list(map(int,input().split()))
b.sort()
c=b[0]

for i in range(1,a):
  c=(c+b[i])/2
  
print(c)

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:
'''
date +%Y.%m.%d

题解先咕着。
'''
def intinput():
    return [int(i) for i in input().split()]

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[ ]:


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


# In[ ]:


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

Submission status: Accepted

Solution code:
def InputToInt():
    A = input().split()
    for i in range(len(A)):
        A[i] = int(A[i])
    return A


if __name__ == '__main__':
    N=int(input())
    A = InputToInt()
    A.sort()
    su = 0
    for i in range(1, N):
        su += A[-i]*(0.5**i)
    su += A[0]*(0.5**(N-1))
    print(su)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0.0 + 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()

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

ans=V[-1]
print(str(ans))

Submission status: Accepted

Solution code:
def f(v, i):
    if i == 0:
        return v/(2**(N-1))
    return v/(2**(N-i))

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

print(sum(f(V[i], i) for i in range(N)))

Submission status: Accepted

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

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

Submission status: Accepted

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

V.sort()
m = V[0]
for v in V[1:]:
    m = (m+v)/2
print(m)

Submission status: Accepted

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

v_array.sort()

# print(v_array)
v_sum = 0
bairitu = 1
for i,v in enumerate(v_array[::-1]):
    if i != N-1:
        bairitu *= 0.5
    v_sum += bairitu * v

print(v_sum)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))
# 鍋に入れる回数が多いほど寄与度は下がる
v.sort()

ans = 0
for idx, value in enumerate(v):
    if idx == 0 or idx == 1:
        ans += value * 1 / (2 ** (N - 1))
    else:
        ans += value * 1 / (2**(N - idx))
print(ans)

Submission status: Accepted

Solution code:

def main():
	N = int(input())
	V = sorted([int(f) for f in input().split()])
	
	value = V[0]
	V = V[1:]
	for v in V:
		value = (value + v) / 2.0
	print(value)
	
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
N = input()
v = map(float, raw_input().split())

v.sort()
ans = v[0]
for t in v[1:]:
  ans = (ans+t)/2
print "%.10f"%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:
from functools import reduce

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

v.sort()

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

Submission status: Accepted

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

def main():
  n = int(input())
  vlist = list(map(int, input().split()))
  vlist = list(sorted(vlist, key=lambda x: -x))
  ans = 0
  for i, v in enumerate(vlist):
    ans += v / pow(2, i+1)
  ans += vlist[-1] / pow(2, len(vlist))
  print('%.10f' % 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 = (ans + V[i]) / 2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = [int(i) for i in 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 fractions import Fraction

N = int(input())
v_list = list(map(int, input().strip().split()))
v_list.sort()

total = Fraction(v_list.pop(0), 1)
for v in v_list:
	total = (Fraction(v, 1) + total) / 2

print(float(total))

Submission status: Accepted

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

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

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

Submission status: Accepted

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

V.sort()

ansvalue = V[0]

for v in V:
    ansvalue = (ansvalue + v) / 2

print(ansvalue)

Submission status: Accepted

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

v.sort(reverse=True)

while len(v)!=1:
    tmp=(v.pop()+v.pop())/2
    v.append(tmp)
print(*v)

Submission status: Accepted

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

ans = 0
li.sort()



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

        
print(ans)

Submission status: Accepted

Solution code:
import heapq

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

heapq.heapify(V)

for i in range(n-1):
    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())

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

while len(v) != 1:
    v = sorted(v)
    
    v.append((v[0]+v[1])/2)
    
    v = v[2:]

print(v[0])

Submission status: Accepted

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

V.sort(key= lambda x:-x)

ans =  0
for i,v in enumerate(V):
    ans += v/(2**min(i+1,N-1))

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()

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

print(cur)

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

Submission status: Accepted

Solution code:
_ = input()
v_list = [int(i) for i in input().split()]

v_list_sorted = sorted(v_list)

result = v_list_sorted[0]

for v in v_list_sorted[1:]:
    result = (result + v) / 2

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
vs = sorted(v,reverse=False)
last = 0
for i in range(1,n):
    if i == 1:
        last = (vs[i-1] + vs[i])/2
    else:
        last = (last + vs[i])/2

print(last)

Submission status: Accepted

Solution code:
# 2019/08/18
# AtCoder Beginner Contest 138 - C

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

# Sort
v.sort()
#v.reverse()

# Sum
sav_v = v[0]
for i in range(1, n):
    sav_v = (sav_v + v[i]) / 2

ans = sav_v

# Output
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

import heapq
heapq.heapify(vs)
while len(vs) > 1:
  a = heapq.heappop(vs)
  b = heapq.heappop(vs)
  c = float(a+b)/2
  heapq.heappush(vs, c)
print (vs[0])

Submission status: Accepted

Solution code:
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    N = int(sys.stdin.readline())
    L = list(map(int, sys.stdin.readline().split()))
    L = sorted(L)
    ans = L[0]
    for l in L[1::]:
        ans = (ans + l) / 2
    print(ans)

Submission status: Accepted

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

ans = V[0]
V = V[1:]

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

v.sort()


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

print(v[0])

Submission status: Accepted

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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())
V = [int(_) for _ in input().split()]

V.sort()

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

Submission status: Accepted

Solution code:

N = int(input())

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

v.sort()


now = v[0]

for i in range(N-1):

    i += 1

    now = (now + v[i]) / 2

print (now)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import heapify, heappush, heappop
N = int(input())
V = list(map(int, input().split()))

heapify(V)

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

print(heappop(V))

Submission status: Accepted

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

Submission status: Accepted

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

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

N = int(input())
Vs = list(map(int, input().split()))
Vs.sort()

s = 0
coeff = 1
for i, v in enumerate(Vs):
    if i <= 1:
        s += v
    else:
        coeff *= 2
        s += v * coeff

t = 2 ** (N - 1)

print("{:.15f}".format(s / t))

Submission status: Accepted

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

while 1 < len(V):
    V = sorted(V)
    V = [ (V[0] + V[1]) / 2.0 ] + V[2:]

print(V[0])

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return sys.stdin.readline().strip()
INF = 10 ** 18
MOD = 10 ** 9 + 7

debug = True
debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

def solve():
    N = II()
    v_list = LI()

    v_list = sorted(v_list)

    while True:
        if len(v_list) <= 2:
            break
        newv = (v_list[0] + v_list[1]) / 2
        v_list = [newv] + v_list[2:]
        v_list = sorted(v_list)

    print((v_list[0]+v_list[1])/2)

solve()

Submission status: Accepted

Solution code:
n=int(input())
A=[int(o) for o in input().split()]
ans=0

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

A = sorted(A)


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

print("%.9f" % A[n - 1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
s=list(map(int, input().split(" ") ))
ss = sorted(s)
s0 = ss[0]

for i in ss[1:]:
    s0 = (i+s0)/2
print(s0)

Submission status: Accepted

Solution code:
import heapq
N = int(input())
v_list = list(map(int, input().split()))

v_list.sort()

heapq.heapify(v_list)

while len(v_list) > 1:
    a = heapq.heappop(v_list)
    b = heapq.heappop(v_list)
    heapq.heappush(v_list, (a+b)/2)
print(heapq.heappop(v_list))

Submission status: Accepted

Solution code:
# coding: utf-8

import sys
import math
import collections
import itertools
def input(): return sys.stdin.readline().strip()
def gcd(x, y): return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y): return (x * y) // gcd(x, y)
MOD = 10 **9 + 7

N = int(input())
# S = input()
# N, M = map(int, input().split())
# 横
V = [int(x) for x in input().split()]
# 縦
# A = [int(input()) for _ in range(N)]
# 多次元
# L = [[int(x) for x in input().split()] for _ in range(N)]

V.sort()
ans = V[0]

for i, v in enumerate(V) :
    if i == 0 :
        continue
    
    ans = (ans + v) / 2

print(ans)

Submission status: Accepted

Solution code:
import heapq

# お約束
INF = float("inf")
MOD = int(1e9 + 7)
def int1(n):
    return int(n) - 1
def parse(*args):
    # (tuple(map(int, input().split())) for _ in range(N))
    return tuple(p(v) for p, v in zip(args, input().split()))

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

que = []

for v in V:
	heapq.heappush(que, v)

res = 0
while que:
	v1, v2 = heapq.heappop(que), heapq.heappop(que)
	if not que:
		res = (v1 + v2) / 2
		break
	heapq.heappush(que, (v1 + v2) / 2)

print(res)

Submission status: Accepted

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

v.sort()

before = v[0]
for i in v[1:]:
    before = (before + i) / 2

print(before)