Problem:


Score : 300 points

Problem Statement

You have a pot and N ingredients. Each ingredient has a real number parameter called value, and the value of the i-th ingredient (1 \leq i \leq N) is v_i.

When you put two ingredients in the pot, they will vanish and result in the formation of a new ingredient. The value of the new ingredient will be (x + y) / 2 where x and y are the values of the ingredients consumed, and you can put this ingredient again in the pot.

After you compose ingredients in this way N-1 times, you will end up with one ingredient. Find the maximum possible value of this ingredient.

Constraints

2 \leq N \leq 50

1 \leq v_i \leq 1000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
v_1 v_2 \ldots v_N

Output

Print a decimal number (or an integer) representing the maximum possible value of the last ingredient remaining.

Your output will be judged correct when its absolute or relative error from the judge's output is at most 10^{-5}.

Sample Input 1

2
3 4

Sample Output 1

3.5

If you start with two ingredients, the only choice is to put both of them in the pot. The value of the ingredient resulting from the ingredients of values 3 and 4 is (3 + 4) / 2 = 3.5.

Printing 3.50001, 3.49999, and so on will also be accepted.

Sample Input 2

3
500 300 200

Sample Output 2

375

You start with three ingredients this time, and you can choose what to use in the first composition. There are three possible choices:

Use the ingredients of values 500 and 300 to produce an ingredient of value (500 + 300) / 2 = 400. The next composition will use this ingredient and the ingredient of value 200, resulting in an ingredient of value (400 + 200) / 2 = 300.

Use the ingredients of values 500 and 200 to produce an ingredient of value (500 + 200) / 2 = 350. The next composition will use this ingredient and the ingredient of value 300, resulting in an ingredient of value (350 + 300) / 2 = 325.

Use the ingredients of values 300 and 200 to produce an ingredient of value (300 + 200) / 2 = 250. The next composition will use this ingredient and the ingredient of value 500, resulting in an ingredient of value (250 + 500) / 2 = 375.

Thus, the maximum possible value of the last ingredient remaining is 375.

Printing 375.0 and so on will also be accepted.

Sample Input 3

5
138 138 138 138 138

Sample Output 3

138



Sample input:
2
3 4


Sample output:
3.5

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#C問題
#先に入れるものほど1/2がかかる回数が増えるので
#小さいもの順に使う貪欲解法

n = int(input())
nums = list(map(lambda x : int(x), input().split()))

nums.sort()
ans = 0
for i in range(n):
    ans += nums[i]
    if i > 0:
        ans = ans / 2.0

print(ans)

Submission status: Accepted

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

while len(v) != 1:
    new_v = (v[0] + v[1]) / 2
    del v[0]
    del v[0]
    v.append(new_v)
    v.sort()
print(v[0])

Submission status: Accepted

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

for i in range(n-1):
    a, b = v.pop(), v.pop()
    v.append((a+b)/2)
    v = sorted(v, reverse=True)

print(*v)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
v.sort(reverse=False)
ans = []
ans.append(v[0])

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

print(ans[-1])

Submission status: Accepted

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

v.sort()

ans = v.pop(0)
for i in v:
    ans = (ans + i)/2

print(ans)

Submission status: Accepted

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

sorted_v = sorted(vlist)

price = 0
for v in sorted_v:
    if price == 0:
        price = v
    else:
        price = (price + v)/2
        
print(price)

Submission status: Accepted

Solution code:
n = int(input())
values = sorted(map(float, input().split()), reverse=True)

while len(values) >= 2:
    a = values.pop()
    b = values.pop()
    values.append((a + b) / 2)

print(values.pop())

Submission status: Accepted

Solution code:

N = input()
V = list(map(int, input().split()))
V = sorted(V)
value = V.pop(0)
while V:
    value =(value + V.pop(0))/2
print(value)

Submission status: Accepted

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

Submission status: Accepted

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

v.sort()

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

print((first+v[n-1])/2)

Submission status: Accepted

Solution code:
n = input()
a = map(float, raw_input().split())

a.sort()

while len(a) != 1:
  x = a.pop(0)
  y = a.pop(0)
  a.append((x + y) / 2)
  a.sort()

print a[0]

Submission status: Accepted

Solution code:
#coding utf-8
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())
values = sorted([int(x) for x in input().split()])

combined_value = values[0]
sliced_values = values[1:]
for value in sliced_values:
  combined_value = (combined_value + value) / 2

print(round(combined_value, 5))

Submission status: Accepted

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

list.sort(reverse = True)

while(len(list) > 1):
    vj = list.pop()
    vi = list.pop()
    vk = (vi + vj)/2
    list.append(vk)
    list.sort(reverse = True)

print(list[0])

Submission status: Accepted

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

v.sort()

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

print(v[N-1])

Submission status: Accepted

Solution code:
n=int(input())
s=input()
li=s.split(" ")
for i in range(len(li)):
    li[i]=int(li[i])
li.sort()
ans=(li[0]+li[1])/2
if len(li)>2:
    for i in range(2,len(li)):
        ans=(ans+li[i])/2
print(ans)

Submission status: Accepted

Solution code:
import math
import sys
import numpy as np
from collections import defaultdict, deque, Counter 
from itertools import accumulate, product, permutations,combinations, combinations_with_replacement
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd

max_value = 1000000000
min_value = -1000000000
sys.setrecursionlimit(max_value)


n = int(input())
v_list = list(map(float,input().split()))
v_list.sort()

v_list = np.array(v_list)


for i in range(n):
	v_list[i] = v_list[i] / (2**(n-i))
v_list[0] = v_list[0] * 2

print((np.sum(v_list)))

Submission status: Accepted

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

input()
ingredients = list(map(float, input().split()))

ingredients.sort()
# print(ingredients)

while True:
    first = ingredients.pop(0)
    second = ingredients.pop(0)
    # print("{}, {}".format(first, second))
    new_ingredient = (first + second) / 2
    ingredients.insert(0, new_ingredient)
    if len(ingredients) == 1:
        break

print(ingredients[0])

Submission status: Accepted

Solution code:
n=int(input())
arr=list(map(int,input().split()))
while len(arr)>1: #最後の1つになるまで操作を続ける
 arr=sorted(arr) #配列を昇順ソート
 v1=arr.pop(0) #最小の2数を取り出し、それらを合成したものを配列に追加する
 v2=arr.pop(0)
 arr.append((v1+v2)/2)
print(arr[0]) #最後に残ったものが答えとなる

Submission status: Accepted

Solution code:
import math
import numpy as np


#横並び
#a, b, c, x = map(int, [input() for i in range(4)])
#z = list(map(int, input().split()))
#n, a, b = map(int, input().split())

#print(len(z))
#for i in z:
#    print(i)

#a = sorted(a,reverse = True)
#print(sum(a[::2]) - sum(a[1::2]))
#z = map(int, [input() for i in range(int(n))])
#data_list = [ list(map(int,input().split(" "))) for i in range(3)]


n = int(input())
a = list(map(int,input().split()))
a.sort()

v = a[0]

for i in a:
    v = (v + i)/2

print(v)

Submission status: Accepted

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

for i in range(n-1):
  min1 = min(v)
  v.remove(min1)
  min2 = min(v)
  v.remove(min2)
  v.append((min1+min2)/2)

print(v[0])

Submission status: Accepted

Solution code:


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

v.sort(reverse=True)

while(True):
    
    if(len(v) <= 1):
        break
    
    a = v.pop()
    b = v.pop()
    v.append((a+b)/2)

print(v[0])

Submission status: Accepted

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

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

print(x)

Submission status: Accepted

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

vc = sorted(v)

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

print(vc[n-1])

Submission status: Accepted

Solution code:
import numpy as np

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

v.sort()
v = np.array(v)
c = np.array([1] + [2**i for i in range(N-1)])

print(np.sum(v * c) / 2**(N-1))

Submission status: Accepted

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

Submission status: Accepted

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


total_value = 0
for i in range(1,N):
    if i != 1:
        total_value += A[i]/pow(2, N-i)
    else:
        total_value += (A[0]+A[1])/pow(2, N-1)
    
print(total_value)

Submission status: Accepted

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

Submission status: Accepted

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

vs.sort(reverse=True)

def solve(v):
    if len(v) > 2:
        ans = v[0]/2 + solve(v[1:])/2
    else:
        ans = sum(v)/2
    return ans

print(solve(vs))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from functools import reduce
from decimal import Decimal

cnt = int(raw_input())
materials = [Decimal(str(m)) for m in raw_input().split()]
materials = sorted(materials)
total = reduce(lambda x, y: (x + y) / 2, materials)
print float(total)

Submission status: Accepted

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

V = sorted(V)

ans = V[0]

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

L.sort()

for i in range(N-1):

    new = L[0] + L[1]
    new /= 2
    
    L = L[2:]
    L.append(new)
    L.sort()

print('{:.6f}'.format(L[0]))

Submission status: Accepted

Solution code:
def sort_index(a):
    for i in range(len(a)):
        for j in range(i + 1, len(a)):
            if a[i] > a[j]:
                a[i], a[j] = a[j], a[i]
    return a


def get_answer(n, a):
    n = int(n)
    a = [int(v) for v in a.split(" ")]
    a = sort_index(a)
    v_max = 0
    v = a[0]
    for i in range(1, len(a)):
        v = (v + a[i]) / 2
    if v > v_max:
        v_max = v
    return v_max



if __name__ == "__main__":
    input1 = input()
    input2 = input()
    print(get_answer(input1, input2))

Submission status: Accepted

Solution code:
n=int(input())
v=sorted([int(i) for i in input().split()])
while len(v)>1:
    res=v[0]+v[1]
    v=v[2:]
    v.append(res/2)
    v.sort()
print(v[0])

Submission status: Accepted

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

Vi.sort()

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

print(answer)

Submission status: Accepted

Solution code:
import io
import sys

MOD = 10 ** 9 + 7


def IN_S():
  return input()


def IN_I():
  return int(input())


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


def IN_L_S():
  return list(map(str, input().split()))


def STR_SPLIT(s, n):
  for l in range(0, len(s), n):
    yield s[0 + l:n + l]


def T_IN():
  global test_str
  sys.stdin = io.StringIO(test_str[1:-1])


test_str = '''
3
500 300 200
'''


def MAIN():
  # T_IN()
  A()


def A():
  n = IN_I()
  nums = IN_L_I()
  nums.sort()
  t = nums.pop(0)

  for num in nums:
    t = (t + num) / 2

  print(t)

  return None


def B():
  return None


def C():
  return None


MAIN()

Submission status: Accepted

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

v[0]=v[0]/(2**(n-1))

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

print(sum(v))

Submission status: Accepted

Solution code:
def main():
    N = input()
    in_value = [float(i) for i in input().split(' ')]

    sort_value = sorted(in_value)

    if(N != 1):
        while(len(sort_value) != 1):
            sort_value = [(sort_value.pop(0) + sort_value.pop(0)) / 2] + sort_value
                       
    print(sort_value[0])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    N = input()
    in_value = [float(i) for i in input().split(' ')]

    sort_value = sorted(in_value)

    if(N != 1):
        while(len(sort_value) != 1):
            min_avg = (sort_value.pop(0) + sort_value.pop(0)) / 2
            sort_value.append(min_avg)
            sort_value = sorted(sort_value)

    print(sort_value[0])


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
nums = sorted(map(lambda x: int(x), input().split(' ')))
res = nums[0] / 2**n
for index, num in enumerate(nums):
    res += num / 2**(n - index)
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

if ans == int(ans):
    print(int(ans))
else:
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
#x, y = map(int, input().split())
#a = [list(map(int, input().split())) for _ in range(N)]
v = list(map(int, input().split()))
#s = input()
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 heapq


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

    while len(v) >= 2:
        x = heapq.heappop(v)
        y = heapq.heappop(v)
        z = (x+y)/2
        heapq.heappush(v, z)
    print(v[0])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import heapq

heapq.heapify(V)

while len(V) >= 2:
    x = heapq.heappop(V)
    y = heapq.heappop(V)
    heapq.heappush(V, (x + y) / 2)

print(V[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

V.sort()


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

print(V[N-1])

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    V=LI()
    ans = 0
    for i in range(N-1):
        V.sort()
        V.append((V[0]+V[1])/2)
        V.remove(V[0])
        V.remove(V[0])
    print(*V)
            
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
Vs = sorted(list(map(int, input().split())), reverse=True)

def mysorted(lst, value):
    i = 0
    for i in range(len(lst)):
        if lst[i] <= value:
            break
    res = lst[:i]
    res.append(value)
    res.extend(lst[i:])
    return res

for i in range(N-1):
    composed_item = (Vs[N-2-i] + Vs[N-1-i]) / 2
    Vs = mysorted(Vs[:N-2-i], composed_item)

print(Vs[0])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = sorted([int(i) for i in input().split()], reverse=True)
factors = [2**(min(i + 1, n - 1)) for i in range(n)]
print(sum([i / j for i, j in zip(v, factors)]))

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

Submission status: Accepted

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

L.sort()

while True:
    a = L.pop(0)
    b = L.pop(0)
    tmp = (a + b) / 2
    L.append(tmp)
    L.sort()
    if len(L) == 1:
        print(tmp)
        break

Submission status: Accepted

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

v.sort()

while True:
    head = v.pop(0)
    next = v.pop(0)

    avg = (head + next) / 2

    if len(v) == 0:
        print(avg)
        break
    else:
        v.append(avg)
        v.sort()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
from itertools import *
import sys
import time


#################### library ####################


#################### naive ####################


#################### process ####################

def read_array():
	N = int(input())
	A = map(float, raw_input().split())
	return A


#################### main ####################

#t0 = time.clock()
vs = sorted(read_array())
print reduce(lambda x, y: (x+y)/2, vs)
#print >>sys.stderr, "%.6fsec" % (time.clock() - t0,)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
#num= list(map(int, input().split()))
#s = input()
n = int(input())
v= list(map(int, input().split()))
v.sort()
for i in range(n-1):
  v[i+1] = (v[i]+v[i+1])/2
print(v[n-1])

Submission status: Accepted

Solution code:
# coding: utf-8

if __name__ == "__main__":
    n = int(input())
    v = sorted(list(map(int, input().split())))
    while len(v)!=1:
        v[0] = (v[0]+v.pop(1))/2
    print(v[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(V[0])

Submission status: Accepted

Solution code:
n = int(input())
numbers = input()
numArr = str.split(numbers)
numList = []
for str in numArr:
    numList.append(int(str))
numList.sort()
if len(numList) >= 2:
    sum = numList[0]
    for i in range(1, n):
        sum = (sum + numList[i])/2
    print(sum)
else:
    print('error')

Submission status: Accepted

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

numerator = vs[0] + vs[1]
for i in range(2, n):
    numerator += (2 ** (i - 1)) * vs[i]
denominator = 2 ** (n - 1)
print(1.0 * numerator / denominator)

Submission status: Accepted

Solution code:
num = int(input())
num_list = sorted(list(map(int,input().split())))
val = num_list[0]
num_list.pop(0)
for i in num_list:
    val = (val+i)/2
print(val)

Submission status: Accepted

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

sum = v.pop(0)
for i in v:
    sum += i
    sum = sum/2

print(sum)

Submission status: Accepted

Solution code:
# -*- coding: UTF-8 -*-
n = int(input())
v = list(map(int,input().split()))

v.sort()

for i in range(len(v)-1):
    g = (v[0] + v[1])/2
    del v[:2]
    v.insert(0, g)

print(v[0])

Submission status: Accepted

Solution code:
N = int(input())
Value = list(map(int,input().split()))
Value = sorted(Value)
Sum = Value[0]
for i in Value:
    Sum = (Sum+i)/2.0
print(Sum)

Submission status: Accepted

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

v.sort()

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

print(value)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int,input().split()))
s = 0.0
for i in range(N-1):
	t = (0.5)**(i+1)
	u = max(v)
	s = s + t*float(u)
	v.remove(u)

s = s + ((0.5)**(N-1))*v[0]

print(s)

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(n-1):
    ans = float(ans + v[i+1])/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)

Submission status: Accepted

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

V.sort(reverse=True)

for _ in range(n-1):
    v1 = V.pop(-1)
    v2 = V.pop(-1)
    v = (v1 + v2) / 2
    V.append(v)

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import heapq
v = []
n = int(input())
v_0 = list(map(int,input().split()))
for u in v_0:
    heapq.heappush(v,u)
max = heapq.heappop(v)*((1/2)**(n-1))
while v:
    max += heapq.heappop(v)*((1/2)**(n-1))
    n -= 1
print(max)

Submission status: Accepted

Solution code:
from functools import reduce
n = int(input())
v = list(map(int, input().split()))
v.sort()
output = reduce((lambda x, y: (x + y) / 2), v)
print(output)

Submission status: Accepted

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

while len(v)>=2:
  v = sorted(v,reverse=True)
  v1 = v.pop()
  v2 = v.pop()
  v.append((v1+v2)/2)

print(*v)

Submission status: Accepted

Solution code:
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
L=list(map(int,input().split()))

lists=sorted(L)

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

print(lists[0])

Submission status: Accepted

Solution code:
import functools
N = int(input())
v = list(map(int, input().split()))
v.sort()
fun = lambda a,b : (a+b)/2
print(functools.reduce(fun, v))

Submission status: Accepted

Solution code:
input()
M = sorted(list(map(int, input().split())))
D = M.pop(0)
for N in M:
  D = ((D + N) / 2)
print (D)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

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

Submission status: Accepted

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

v_max = A[0]
for num in A[1:]:
  v_max = (v_max+num)/2
print(v_max)

Submission status: Accepted

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

Submission status: Accepted

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

ans = a_list[0]
for i in range(N-1):
    ans = (ans + a_list[i+1]) / 2.0
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce

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

l.sort()
ans = reduce(lambda x,y: (x+y)/2,l)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#Coding:Utf-8

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

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

print(v[0])

Submission status: Accepted

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

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

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
a = list(map(float, input().split()))

a.sort()
b = [0.5,0.5]
for i in range(n-2):
    b = list(map(lambda x: x*0.5, b)) + [0.5,]

print(sum(np.array(a)*np.array(b)))

Submission status: Accepted

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

ingredients.sort()

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

Submission status: Accepted

Solution code:
import numpy as np

n=int(input())
a=list(map(float,input().split()))
s=np.sort(a)

tmp=s[0]

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

print(tmp)

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify

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

heapify(values)

while len(values) > 1:
  a = heappop(values)
  b = heappop(values)
  heappush(values, (a+b) / 2)
  
print(values[0])

Submission status: Accepted

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

v.sort()

ans = 0

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

print(ans)