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:
from decimal import *

n = int(raw_input())
a = map(int, raw_input().split())

a.sort()

cur = Decimal(a[0])

for i in xrange(1, n):
	cur = (cur + Decimal(a[i]))/Decimal(2)

print cur

Submission status: Accepted

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

v.sort()

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

print(v0)

Submission status: Accepted

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

ans = 0
for i, v in enumerate(v):
    if i == 0:
        ans += v/(2**(N-1))
        continue
    ans += v/(2**(N-i))
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(float,input().split()))
A.sort()
ans=A[0]/2**N
for a in A:
	ans+=a/2**N
	N-=1
print(ans)

Submission status: Accepted

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

xs = sorted(xs)

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

print(tmp)

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

Submission status: Accepted

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

while len(vs) > 1:
    a = vs.pop(0)
    b = vs.pop(0)
    r = (a+b)/2
    
    for i, v in enumerate(vs):
        if v > r:
            vs.insert(i, r)
            break
    else:
        vs.append(r)
        
print(vs[0])

Submission status: Accepted

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

v.sort()
ans = v[0]/(2**(N-1))

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

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#ABC138 C

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
v = LI()
v.sort()
if n == 2:
    print(sum(v)/2)
    quit()
ans = (v[0]+v[1])/2
for i in range(2,n):
    x = (ans+v[i])/2
    ans = x
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[n-1])

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

Submission status: Accepted

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

if __name__ == '__main__':
    N = int(input())
    V = list(map(int, input().split()))

    while True:
        V.sort(reverse=True)
        V[-2] = (V[-2]+V[-1])/2
        V = V[:-1]

        if len(V)==1:
            break

    print(V[0])

Submission status: Accepted

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

# print(line)

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

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

val2 = sorted(val)
for i in range(len(val2)-1):
    val2[1] = (val2[0]+val2[1])/2
    val2.pop(0)
print(val2[0])

Submission status: Accepted

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

ans = V[0]
for i in range(len(V)):
    if i == 0:
        continue
    ans = (ans + V[i]) / 2
print(ans)

Submission status: Accepted

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

v.sort()

ans = 0.0
vk = 0.0

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

print(ans)

Submission status: Accepted

Solution code:
inpl = lambda: list(map(int,input().split()))
N = int(input())
V = inpl()
V.sort(reverse=True)
ans = 0
factor = 1
for v in V:
    factor /= 2
    ans += factor*v
ans += factor * v
print(ans)

Submission status: Accepted

Solution code:
def getlist():
	return list(map(int, input().split()))

N = int(input())
v = getlist()

v = sorted(v)

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

print(val)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    V = [int(s) for s in input().split()]
    V.sort()

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

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

    print(sol)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
v=[int(i) for i 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 = [int(i) for i in input().split()]
# print(V.sort())
# V= V.sort()
V.sort()
# print(V)
result = V[0]
for i in range(N):
    result += (V[i]-result)/2.

print(result)

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

for n in range(N-1):
  V.append((V[0] + V[1]) / 2)
  del V[0]
  del V[0]
  V.sort()

print(V[0])

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 += a[i]
  ans /= 2

print(ans)

Submission status: Accepted

Solution code:
import sys 
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
v = na()
v.sort(reverse=False)
ans = v[0]

for vi in v[1:]:
        ans = (ans + vi) / 2

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
v=[int(i) for i 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())
array = [int(i) for i in input().split()]

array.sort()

sum = 0
for i in range(n):
  if i == 0:
    sum = array[0]
  else:
    sum = (sum+array[i])/2
    
print(sum)

Submission status: Accepted

Solution code:
a=[]
b=int(input())
i=0
for x in input().split(" "):
    a.append(int(x))
a.sort()
while i<b-1:
    a[i+1]=(a[i]+a[i+1])/2
    i+=1
print(a[-1])

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())
v=np.array(sorted([int(i) for i in input().split(" ")]))
tmp = [1/2**(n-1)] + [1/2**(i-1) for i in range(n, 1, -1)]
print(np.sum(v*tmp))

Submission status: Accepted

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

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 = 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())
li = list(map(int,input().split()))
li.sort(reverse = True)
li2 = []
for i in range(N):
    soeji = i+1
    if i == N-1:
        soeji = i
    li2.append(li[i]/(2**soeji))
print(sum(li2))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

vs.sort(reverse=True)
value = 0
for i in range(1, N+1):
    div = 2 ** i
    if i == N:
        div = 2 ** (N - 1)
    value += vs[i-1] / div
print(value)

Submission status: Accepted

Solution code:
from functools import reduce

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

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

Submission status: Accepted

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

print(z)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
N = int(input())
V = sorted(map(int, input().split()))
avgsum = V[0]
for num in V:
    avgsum = (avgsum + num) / 2
print(avgsum)

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

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

for i in range(n):
    if len(v)>1:
        mean=(v[0]+v[1])/2
        v=v[2:]
        v.append(mean)
        v.sort()

print(v[0])

Submission status: Accepted

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

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

print(tmp)

Submission status: Accepted

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

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

print(tmp)

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
an = list(map(int, input().split()))
an.sort();

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = list(int(i) for i in input().split())
V.sort()

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

Submission status: Accepted

Solution code:
import heapq

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

heapq.heapify(v)

while v:
  tmp = heapq.heappop(v)
  if v:
    tmp += heapq.heappop(v)
    heapq.heappush(v,tmp/2)
print(tmp)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
v = sorted(v)
sum_ = v[0]/(2**(n-1))

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

print(sum_)

Submission status: Accepted

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


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

print(v[i])

Submission status: Accepted

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

cache = 0
for x in v:
    if cache == 0:
        cache = x
    else:
        cache = (cache+x)/2

print(cache)

Submission status: Accepted

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

V_list.sort()

bunsi = 2 ** (N - 1)

ans = 0
ans += V_list[0] / bunsi

for i, v in enumerate(V_list[1:]):
    ans += (v / bunsi) * 2 ** i

print(ans)

Submission status: Accepted

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

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

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

print(v[N-1])

Submission status: Accepted

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

v.sort()

tmp=v.pop(0)

for i in range(N-1):
	tmp=(tmp+v.pop(0))/2

print(tmp)

Submission status: Accepted

Solution code:
N = int(input())

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

v = sorted(v)

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

print(v[-1])

Submission status: Accepted

Solution code:

def solve():
    N = int(raw_input())
    v = [int(_) for _ in raw_input().split()]
    v.sort()
    new_mat = v[0]
    for i in range(1, N):
        new_mat = (new_mat + v[i]) / 2.0
    print new_mat

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
def main():
    _ = int(input())
    v = sorted([int(x) for x in input().split()])
    # 小さい方から足す
    for num in range(len(v) - 1):
        v[num + 1] = (v[num] + v[num + 1]) / 2
    print(v[-1])

if __name__ == "__main__":
    main()

Submission status: Accepted

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

v.sort()

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

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,*V=list(map(int,open(0).read().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

i = 0
sorted_v = sorted(v)
t = sorted_v[0]
for x in sorted_v:
    t = (t + x)/2
    
print(t)

Submission status: Accepted

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

newv=sorted(v)

for i in range(n-1):
    if i==0:
        sum=(newv[0]+newv[1])/2
        continue
    else:
        sum=(sum+newv[i+1])/2

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())
V = [float(x) for x in stdin.readline().rstrip().split()]

V.sort(reverse=True)
ans = 0

while len(V) > 1:
    ans += (V[len(V) - 1] + V[len(V) - 2]) / 2
    new = (V[len(V) - 1] + V[len(V) - 2]) / 2
    V.pop()
    V.pop()
    V.append(new)

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

v = sorted(v)

ans = v[0]

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from heapq import heapify, heappop, heappush
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:
#import pysnooper
import os,re,sys,operator,math,heapq,string
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy

setrecursionlimit(10**6)

n=int(stdin.readline().rstrip())
v=sorted([int(i) for i in stdin.readline().rstrip().split()])
now=(v[0]+v[1])/2
for i in range(2,n):
    now=(now+v[i])/2
print(now)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def acinput():
    return list(map(int, input().split(" ")))

import numpy as np

N=int(input())
V=sorted(acinput())

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
lis=list(map(int,input().split()))
lis.sort()
a=(lis[0]+lis[1])/2
ans=[a]
if n>=3:
    for i in range(n-2):
        b=(ans[i]+lis[i+2])/2
        ans.append(b)

print(ans[n-2])

Submission status: Accepted

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

Submission status: Accepted

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

V = sorted(V)

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

Submission status: Accepted

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

v_list.sort()

value = v_list[0]
# print(value)
for i in v_list[1:]:
    value = (value + i)/2
#     print(value)
print(value)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq as q

def main():
	n = int(input())
	a = list(map(int,input().split()))
	s = []
	for i in a:
		q.heappush(s,i)
	while len(s) != 1:
		a = q.heappop(s)
		b = q.heappop(s)
		q.heappush(s,(a+b)/2)
	print(q.heappop(s))
main()

Submission status: Accepted

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

ans = sorted_v[0]
for i in sorted_v[1:]:
    ans = (ans + i) / 2
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
para = [int(i) for i in input().split()]
para.sort()
ans = 0
for i in range(N-1):
    if ans == 0 :
        ans += (para[0]+para[1])/2
    else :
        ans = (ans+para[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):
  v[0] = (v[0] + v[1])/2
  ans = v[0]
  v[1] = 1001
  v.sort()

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())
    v = sorted([int(i) for i in input().split()])

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

    print(j)


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(n-1):
  if i == 0:
    temp = l[i]
  else:
    temp = (temp+l[i])/2
else:
  print((temp+l[-1])/2)

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[1] + V[0]) / 2
	if len(V) == 1:
		break
	else:
		V.pop(1)
print(V[0])

Submission status: Accepted

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

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()
out = (v[0]+v[1])/2

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

print(out)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

v.sort()

sum = v[0]

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

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

Solution code:
n = int(input())

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

ls = sorted(ls)

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

Submission status: Accepted

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

ans = 0
v.sort()

tmp = 0.5 * (v[0] + v[1])

if n == 2:
    print(tmp)
    exit()

for i in range(n-2):
    tmp = (tmp + v[i+2]) * 0.5


print(tmp)

Submission status: Accepted

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

v = sorted(v, reverse=True)
ret = [v[i]/(2.0**(i+1)) for i in range(n)]

ret = sum(ret) + v[-1]/(2.0**n)

print(ret)

Submission status: Accepted

Solution code:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations
import sys
import bisect
import string
sys.setrecursionlimit(10**6)
def SI():
    return input().split()
def MI():
    return map(int,input().split())
def I():
    return int(input())
def LI():
    return [int(i) for i in input().split()]
YN=['Yes','No']
mo=10**9+7

n=I()
a=LI()
a=sorted(a)[::-1]
p=a.pop()
while a:
    p=(a.pop()+p)/2
print(p)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

v = sorted(v)
ans = v[0]

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

print(ans)

Submission status: Accepted

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

sort_v = sorted(v)

for i in range(N):
  if i == 0:
    var = sort_v[0]
  if i >= 1 and i < N-1:
    var = (sort_v[i]+var)/2
  if i == N-1:
    var = (sort_v[i]+var)/2
    print(var)

Submission status: Accepted

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

Submission status: Accepted

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

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

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()
ans = 0
for i, v in enumerate(V):
    if i == 0:
        ans = v
    else:
        ans = float(ans + v) / 2
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

import sys

n=int( sys.stdin.readline().strip() )
v=[ int(x) for x in sys.stdin.readline().strip().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()

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

print(v[0])