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:
# -*- coding: utf-8 -*-
n = int(input())
v = [int(i) for i in input().split()]

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

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, acos, atan, asin, log, log10
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 STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(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()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
v = LIST()
v.sort()
v = deque(v)
for i in range(n - 1):
    v1 = v.popleft()
    v2 = v.popleft()
    v.appendleft((v1 + v2) / 2)
print(v[0])

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import heapq
N = int(input())
H = list(map(int, input().split()))
heapq.heapify(H)
while len(H) >= 2:
  f = heapq.heappop(H)
  s = heapq.heappop(H)
  heapq.heappush(H, (f + s) / 2)
print(H[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
V = sorted(iil())

ans = V[0]

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

print(ans)

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):
  ave=(ans+V[i])/2
  ans=ave
  
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
#a,b=map(int,input().split())
vl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

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

print('{:.9f}'.format(ans))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from heapq import *
n = int(input())
v = list(map(int, input().split()))
heapify(v)
for i in range(n-1):
    a = heappop(v)
    b = heappop(v)
    heappush(v, (a+b)/2)
print(heappop(v))

Submission status: Accepted

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

v.sort(reverse=True)
for i in range(N-1):
    value = (v.pop() + v.pop()) / 2
    v.append(value)

print(v[0])

Submission status: Accepted

Solution code:
import heapq

N = int(input())
v = list(map(float, input().split(" ")))
heapq.heapify(v)

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

V = sorted(V)

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

print(V[0])

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
import heapq

def main():
    N = int(input())
    V = input_nums()
    heapq.heapify(V)
    while len(V) > 1:
        a = heapq.heappop(V)
        b = heapq.heappop(V)
        total = (a+b)/2
        heapq.heappush(V, total)
    print(heapq.heappop(V))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def f(v):
    
    if len(v) == 1:
        print("".join(map(str,v)))
    else:
        v.sort()
        a = v.pop(0)
        b = v.pop(0)
        v.append(((a+b)/2))
        f(v)

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

v.sort()

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

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

print(ans)

Submission status: Accepted

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

v_list.sort()

rest = (v_list[0] + v_list[1]) / 2

for i in range(len(v_list)-2):
    rest = (rest + v_list[i+2]) / 2

print(rest)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np

n=int(sys.stdin.readline())
v=np.array(sys.stdin.readline().split(),dtype='int64')
v=np.sort(v)


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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

lst=sorted(lst, reverse=True)
new=[lst[i]*(1/2)**(i+1) for i in range(n-1)]
print(sum(new)+lst[-1]*(1/2)**(n-1))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input()) #具罪数
v = list(map(int,(input().split()))) #価値
sum_now = 0
sum_old = 0
v.sort()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 15:11:59 2020

@author: Kanaru Sato
"""

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

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

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

print(valuesum)

Submission status: Accepted

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

v.sort(reverse = True)

for i in range(n):
  if len(v) > 1:
    a = v.pop()
    b = v.pop()
    v.append((a + b) / 2)
print(v[0])

Submission status: Accepted

Solution code:
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.buffer.readline().rstrip())
    V = list(map(int, sys.stdin.buffer.readline().split()))
    V.sort()

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

    print(V[N-1])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

while len(v)>1:
    g1, g2 = v[0], v[1]
    g = (g1+g2)/2
    v = [g]+ v[2:]
    v = sorted(v)

print(v[0])

Submission status: Accepted

Solution code:
import sys
import math

from collections import defaultdict
from collections import deque
import heapq
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s

n = load()
v = load_list()

heapq.heapify(v)
while len(v) > 1:
    e1 = heapq.heappop(v)
    e2 = heapq.heappop(v)
    heapq.heappush(v, (e1+e2)/2.0)

print(heapq.heappop(v))

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 x in v[1:]:
        ans = (ans + x) / 2

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

main()

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:
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N = int(input())
    v = [int(x) for x in input().split()]

    v = sorted(v)

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

    print(ans)


# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc138","c",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.0

print(ans)

Submission status: Accepted

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

ans = V[0]

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

Submission status: Accepted

Solution code:
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 価値の少ないものは貢献度を低くする。そのために、最初に混ぜる
N = ir()
V = np.array(lr())
V.sort()
coef = [.5 ** x for x in range(1, N+1)]
coef.reverse()
coef[0] = coef[1]
coef = np.array(coef)
answer = (V * coef).sum()
print('{:.10f}'.format(answer))

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0
p = -1 * (n - 1) 
for i in range(n):
    if i == 0:
        sum += v[i] * 2**p
    else:
        sum += v[i] * 2**p
        p += 1

print(sum)

Submission status: Accepted

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

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

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:
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 = sorted(V,reverse =False)

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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
v = list(map(int,input().split()))
while n > 1:
    temp = np.sum(sorted(v)[:2])/2
    v = sorted(v)[2:]
    v.append(temp)
    n -= 1
print(temp)

Submission status: Accepted

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

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

print(m)

Submission status: Accepted

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

while len(v) > 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=[int(i) for i in 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:
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product

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

    while True:
        V[1]=(V[0]+V[1])/2
        V.pop(0)
        if len(V)==1:
            print(V[0])
            break


resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(N, values):
    while len(values) > 1:
        values.sort()
        x = values.pop(0)
        y = values.pop(0)
        values.append((x + y) / 2)
    return values[0]


N = int(input())
values = [int(v) for v in input().split()]
ans = solve(N, values)
print(ans)

Submission status: Accepted

Solution code:
#138_C
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(heapq.heappop(v))

Submission status: Accepted

Solution code:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
arrA = list(map(int,input().split()))

while len(arrA)>1:
    arrA.sort(reverse = True)
    num = (arrA.pop() + arrA.pop()) / 2
    arrA.append(num)

print(*arrA)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する

Submission status: Accepted

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

for _ in range(n - 1):
    v.sort(reverse=1)
    a = v.pop() + v.pop()
    v.append(a / 2)
print(v[0])

Submission status: Accepted

Solution code:
N = int(input())
vlist = sorted(list(map(int, input().split())))
for _ in range(N-1):
    vlist.insert(0, (vlist.pop(0)+vlist.pop(0))/2)
print(vlist[0])

Submission status: Accepted

Solution code:
N = int(input())

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

li.sort()

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = sorted([int(x) for x in input().split()])
res = 0
for i in range(N):
    if i == 0:
        res += V[i]
    else:
        res = (res + V[i])/2
print(res)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)
u = []
a = 1

u.append(1/2)
u.append(1/2)

for i in range(n-2):
    if n != 2:
        a = u.pop(-1)/2
        u.append(a)
        u.append(a)

u = sorted(u)

s = 0
for i in range(len(v)):
	s += v[i]*u[i]
         
print(s)

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:
# -*- coding: utf-8 -*-
"""
C - Alchemist
https://atcoder.jp/contests/abc138/tasks/abc138_c

"""
import sys


def solve(N, values):
    while len(values) > 1:
        values.sort()
        x = values.pop(0)
        y = values.pop(0)
        values.append((x + y) / 2)
    return values[0]


def main(args):
    N = int(input())
    values = [int(v) for v in input().split()]
    ans = solve(N, values)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

Submission status: Accepted

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

nabe = 0
for n in range(N-1):
    a = heapq.heappop(V)
    a += heapq.heappop(V)
    nabe += a
    heapq.heappush(V, a / 2)

print(V[0])

Submission status: Accepted

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

for i in range(n):
    min1=v.pop(v.index(min(v)))
    min2=v.pop(v.index(min(v)))
    new=(min1+min2)/2
    v.append(new)
    if len(v)==1:
        print(new)
        exit()
#for i in range(n):

Submission status: Accepted

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

def main():
    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)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_ = input()
_v, *v = sorted(map(int, input().split()))
for i in v:
    _v = (_v + i) / 2
print(_v)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input().rstrip())

guzai = list(sorted(map(int, input().rstrip().split(" "))))

ans = guzai[0]

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

print(ans)

Submission status: Accepted

Solution code:
from functools import reduce

n = int(input())
v = sorted(list(map(float, input().split())))
print(reduce(lambda x, y: (x + y) / 2, v))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
v=[int(x) for x 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:
def solve():
    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

    return ans

print(solve())

Submission status: Accepted

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

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

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

while len(v) > 1:
    l = v.pop(0)
    r = v.pop(0)
    t = (l+r)/2
    bisect.insort(v,t)
print(v[0])

Submission status: Accepted

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

v_r = sorted(v)
result = 0
tmp = (v_r[0] + v_r[1]) / 2
for i in range(2,N):
    #print(temp)
    tmp = (tmp + v_r[i]) / 2
print(tmp)

Submission status: Accepted

Solution code:

N = int(input())

A = list(map(int,input().split()))
A = sorted(A)
ans = 0
for i in range(N):
    if i == 0:
        ans += (A[i]+A[i+1])/2
    elif i<N-1:
        ans = (ans+A[i+1])/2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
input()
l=sorted(map(int,input().split()))
a=l.pop(0)
for i in l: a=(a+i)/2
print(a)

Submission status: Accepted

Solution code:
n=int(input())
l=sorted(map(int,input().split()))[::-1]
print(sum(l[i]*.5**-~i for i in range(n))+l[-1]*.5**n)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce

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

V.sort()
print(reduce(lambda a, b: (a + b) / 2, V))

Submission status: Accepted

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

res = v[0]

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

print(res)

Submission status: Accepted

Solution code:

def submit():
    n = int(input())
    vlist = list(map(int, input().split()))
    
    curr_n = n
    while curr_n > 1:
        merge = (0, 0)
        max_sum = 0
        curr_sum = sum(vlist)
        for i in range(curr_n):
            for j in range(i + 1, curr_n):
                merge_sum = curr_sum - vlist[i] - vlist[j] + \
                            (vlist[i] + vlist[j]) / 2
                if max_sum < merge_sum:
                    max_sum = merge_sum
                    merge = (i, j)
                
        avg = (vlist[merge[0]] + vlist[merge[1]]) / 2
        vlist.pop(merge[0])
        vlist.pop(merge[1] - 1)
        vlist.append(avg)
        curr_n -= 1

    print(vlist[0])


if __name__ == "__main__":
    submit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

V.sort()

while len(V) > 1:
    tmp = sum(V[:2]) / 2
    V = V[2:] + [tmp]
    V.sort()

print(V[0])

Submission status: Accepted

Solution code:
# Problem C - Alchemist

# input process
N = int(input())
v_list = list(map(int, input().split()))

# initialization
v_list = sorted(v_list)
ans_list = [0]*(N+1)
ans_list[0] = v_list[0]

# count process
for i in range(N):
    ans_list[i+1] = (ans_list[i] + v_list[i])/2

# output process
print(ans_list[N])

Submission status: Accepted

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

ans=v[0]
def heikin(x,y):
    return (x+y)/2

for i in range(1,n):
    ans=heikin(ans,v[i])
print(ans)

Submission status: Accepted

Solution code:
import math
import bisect
import heapq
from collections import deque

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

v.sort()
heapq.heapify(v)

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

ans = heapq.heappop(v)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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