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

from heapq import heappush, heappop, heapify

heapify(v_list)

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

print(v_list[0])

Submission status: Accepted

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

ans = 0

for i in range(n - 1):
  x = v.pop(v.index(min(v)))
  y = v.pop(v.index(min(v)))

  ans = (x + y) / 2 
  v.append(ans)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq

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


heapq.heapify(V)

while len(V) > 1:
  e1 = heapq.heappop(V)
  e2 = heapq.heappop(V)
  heapq.heappush(V, (e1+e2)/2.)

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = list(open(0))

for i in a:
    s = i.replace('\n','')
    ss = s.split(' ')

txt = []
for i in ss:
    txt.append(int(i))
txt = sorted(txt)

res = 0
for j in range(len(txt))[:-1]:
    if j == 0:
        res += (txt[j] + txt[j+1]) / 2
    else:
        res = (res + txt[j+1]) / 2
print(res)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
vs = list(map(int, input().split()))
def mmm(vs):
    minimum = 10000
    for v in vs:
        if v < minimum:
            minimum = v
    vs.remove(minimum)
    return minimum

for i in range(len(vs)-1):
    m1 = mmm(vs)
    m2 = mmm(vs)
    vs.append((m1+m2)/2)

print(vs[0])

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    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.insert(0, (a+b)/2)
    print(v[0])

Submission status: Accepted

Solution code:
from functools import reduce

def aaa(x, y):
    return (x + y) / 2

N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = reduce(aaa, L)
print(ans)

Submission status: Accepted

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

n_list.sort()

new_list = []
ctr = 0

while len(n_list) > 1:
  n_list[ctr] = (n_list[ctr] + n_list[ctr+1])/2
  n_list.pop(ctr + 1)
  n_list.sort
  
print(n_list[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,n):
    ans = (ans + v[i]) / 2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=eval(input())
l=list(map(int,input().split()))
l=sorted(l)
for i in range(len(l)-1):
    l[1]=(l[0]+l[1])/2
    del l[0]
print(l[0])

Submission status: Accepted

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

b = sorted(a)
for i in range(0,n-1):
    if i == n-1:
        break
    tmp = (b.pop(0)+b.pop(0))/2
    b.insert(0,tmp)

print(b[0])

Submission status: Accepted

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

for i in range(n-1):
      x = a_lis[0]
      y = a_lis[1]
      z = (x+y)/2
      del a_lis[:2]
      a_lis.insert(0,z)
print(a_lis[0])

Submission status: Accepted

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

s += v[0]*(2**-n)
for i in range(n):
    s += v.pop()*(2**-(i+1))

print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = int(input())
childs = list(map(int, input().split()))
childs.sort()
res = 0
for i in range(0, len(childs)-1):
    tmp = 0
    tmp = (childs[i]+childs[i+1])/2
    childs[i+1]=tmp
print(childs[-1])

Submission status: Accepted

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

for i in range(0, n):
    if len(u)==2:
        print((u[0]+u[1])/2)
        exit()
    else:
        u = [(u[0]+u[1])/2] + u[2:]

Submission status: Accepted

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

v = list(map(lambda x: int(x), v))
for i in range(n-1):
  v.sort()
  v.append((v.pop(0)+v.pop(0))/2)
print(v[0])

Submission status: Accepted

Solution code:
# C - Alchemist
N = int(input())
v = list(map(int, input().split()))

new_v = sorted(v)

for i in range(N-1):
    if i == 0 :
        a = (new_v[i]+new_v[i+1])/2
    else:
        a = (a + new_v[i+1])/2
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from fractions import Fraction


def main():

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

    while(len(elements)!=1):
        left = elements.pop(0)
        right = elements.pop(0)
        newElement = (left+right)/2
        elements.append(newElement)
        elements.sort()
    print(elements[0])



if __name__== "__main__":
    main()

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

print(ans)

Submission status: Accepted

Solution code:
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
N = int(input())
a = list(map(int, input().split()))
a = sorted(a)

a1 = a.pop(0)
a2 = a.pop(0)
res = Decimal((a1 + a2) / 2)

for i in range(N - 2):
    res = Decimal((a[i] + res) / 2)

print(res)

Submission status: Accepted

Solution code:
import sys

N = int(input())

v = list(map(int, input().split()))
v.sort(reverse=True)

sum = 0
while v:
    if len(v)==1:
        print(v[0])
        sys.exit()
    s = (v.pop(-1) + v.pop(-1)) / 2
    v.append(s)
    v.sort(reverse=True)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N = int(input())
v = list(map(int,input().split()))
v.sort()

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

print(s)

Submission status: Accepted

Solution code:
#coding:utf-8
def alchemy(x, y):
    val = (x+y)/2
    return val

if __name__ == "__main__":
    n = int(input())
    v = list(map(int, input().split()))
    ans = 0

    for i in range(n-1):
        v = sorted(v)
        new_item = alchemy(v[0], v[1])
        del v[0:2]
        v.append(new_item)
        #print(v_sort)

    print(v[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
vlist = list(map(int,input().split()))
vlist.sort()
ans = 0
a = len(vlist)-1
for _ in range(a):
    vlist.append((vlist[0]+vlist[1])/2)
    del vlist[0:2]
    vlist.sort()
print(vlist[0])

Submission status: Accepted

Solution code:
import heapq

n = int(input())
hp = []
d = 1 << (n - 1)
for v in (d * int(s) for s in input().split()):
    heapq.heappush(hp, v)
for i in range(n - 1):
    x = heapq.heappop(hp)
    y = heapq.heappop(hp)
    #print(x, y)
    heapq.heappush(hp, (x + y) / 2)
print('%.6f' % (hp[0] / d))

Submission status: Accepted

Solution code:
def main():
  N = int(input())
  v = [int(i) for i in input().split()]
  v.sort()
  ans = 0
  for i in range(len(v)-1):
    ans = (ans+v[i+1])/2 if i > 0 else (v[i]+v[i+1])/2
  print(ans)

if __name__ == '__main__':
  main()

Submission status: Accepted

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

for i in range(1, N - 1):
    left = v.pop(v.index(min(v)))
    right = v.pop(v.index(min(v)))
    v.append((left + right) / 2)
    
print((v[0] + v[1]) / 2)

Submission status: Accepted

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

for _ in range(n-1):
    val=v.pop(0)
    v[0]=(v[0]+val)/2

print(v[0])

Submission status: Accepted

Solution code:
n = int(input())
numbers = list(map(int,input().split()))
 
def aaa(numbers):
    if len(numbers) > 1:
        numbers.sort()
        new_number = (numbers[0] + numbers[1]) / 2
        n_0 = numbers[0]
        n_1 = numbers[1]
        numbers.remove(n_0)
        numbers.remove(n_1)
        numbers.append(new_number)
        aaa(numbers)
    else:
        return numbers[0]
      
aaa(numbers)
print(aaa(numbers))

Submission status: Accepted

Solution code:
N = int(input())

v = input().split()

v = [float(i) for i in v]
v.sort()

for i in range(N - 1):
  min1 = v[0]
  min2 = v[1]
  tmp = (min1 + min2) / 2.0
  v.pop(0)
  v.pop(0)
  v.insert(0, tmp)
print(*v)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = str(input())
v_s = s.split()
v_s = [float(str) for str in v_s]
v_s.sort()

idx = 0
while idx < n-1:
  v0 = v_s.pop(0)
  v1 = v_s.pop(0)
  v_s.insert(0, (v0 + v1)/2.0)
  idx += 1

print(v_s.pop(0))

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
v = np.array(input().split(' '), float)

v = np.sort(v)

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

print(value)

Submission status: Accepted

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

if N == 2:
    print((A[0]+A[1])/2)

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

Submission status: Accepted

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

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

y = 0
for i in range(2,n):
  y = y + v[i]/2**(n-i)
print(x + y)

Submission status: Accepted

Solution code:
import heapq

def solve(n, v):
    v_pq = []
    for v_i in v:
        heapq.heappush(v_pq, v_i)

    while len(v_pq) > 1:
        v1 = heapq.heappop(v_pq)
        v2 = heapq.heappop(v_pq)
        heapq.heappush(v_pq, (v1 + v2) / 2)

    return heapq.heappop(v_pq)


if __name__ == "__main__":
    n = int(input())
    v = list(map(int, input().strip().split(" ")))
    print(solve(n, v))

Submission status: Accepted

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

Submission status: Accepted

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


def sumnum(v):
    v.sort(reverse=True)
    a=v.pop()
    b=v.pop()
    v.append((a+b)/2)

for i in range(n-1):
    sumnum(v)
print(v[0])

Submission status: Accepted

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

sort_list = sorted(list_a)

for i in range(N-1):
    
    if i == 0:
        tmp = 1/2 * (sort_list[i] + sort_list[i+1])
    else:
        tmp = 1/2 * (tmp + sort_list[i+1])

print(tmp)

Submission status: Accepted

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

# 最初に投入した具材ほど半分の半分の半分の……になっていく
# つまり小さい順に投入すればいい

sorted_values = sorted(values)

# 順番に足していく
anser_values = [0.0 for _ in range(N)]
anser_values[0] = (sorted_values[0] + sorted_values[1]) / 2
for n in range(2, N):
    anser_values[n - 1] = (anser_values[n - 2] + sorted_values[n]) / 2

print(anser_values[N - 2])

Submission status: Accepted

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

v.sort()
for j in range(n-1):
    new_v = (v.pop(0) + v.pop(0)) / 2
    v.append(new_v)
    v.sort()
print(*v)

Submission status: Accepted

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

Submission status: Accepted

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

while True:
    v.sort(reverse=True)
    v.append((v.pop() + v.pop()) / 2)
    if len(v) == 1:
        break

print(v[0])

Submission status: Accepted

Solution code:
def calc(x, y):
    return (x + y) / 2


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

    for _ in range(N - 1):
        V.sort()
        V.append(calc(V.pop(0), V.pop(0)))

    print(V.pop(0))

    return


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
a = [float(i) for i in input().split()]
a = np.sort(np.array(a))


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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
v.sort()
while True:
    if len(v) == 1:
        print(v[0])
        break
    tmp = v.pop(0)
    v[0] = (v[0] + tmp) / 2

Submission status: Accepted

Solution code:
N = int(input())
v_array = [int(i) for i in input().split()]

for i in range(N-1):
    now_min = v_array[i]
    min_index = i
    for j in range(i+1,N):
        if v_array[j] < now_min:
            min_index = j
            now_min = v_array[j]
    if min_index != i:
        v_array.pop(min_index)
        v_array.insert(min_index,v_array[i])
        v_array.pop(i)
        v_array.insert(i, now_min)

synthesis = v_array[0]

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

print(synthesis)

Submission status: Accepted

Solution code:
import sys


def main():
    n = int(sys.stdin.readline().strip())
    v = [int(s) for s in sys.stdin.readline().strip().split()]

    v.sort()

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


main()

Submission status: Accepted

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

new_vvv = vvv
for _ in range(N - 1):
    merged = sum(new_vvv[:2]) / 2
    new_vvv = [merged] + new_vvv[2:]
    new_vvv.sort()

print(new_vvv[0])

Submission status: Accepted

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

for i in range(N-1):
    v_i = sorted(v_i)
    temp = (v_i[0] + v_i[1]) / 2
    del v_i[0]
    del v_i[0]
    v_i.append(temp)

print(v_i[0])

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = [float(x) for x in input().split(' ')]
a.sort()
x = a[0]
for i in range(1, len(a)):
  x = (x + a[i])/2.0
  
print(x)

Submission status: Accepted

Solution code:
N = int(input())
li = list(map(int,input().split()))
li.sort()
k = 0
while len(li) >1:
    k = (li[0] + li[1]) / 2
    del li[1]
    del li[0]
    li.insert(0,k)
print('{:.10g}'.format(li[0]))

Submission status: Accepted

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

while len(v) >= 2:
    a = (v.pop(0) + v.pop(0))/2
    v.append(a)
    v.sort()

print(v[0])

Submission status: Accepted

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

V.sort(reverse=True)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    try:
        N = int(input())
        A = list(map(int, input().split()))
        A.sort()
        result = None
        for i in A:
            if result is None:
                result = i
                continue
            result += i
            result = result / 2
        print(result)
    except EOFError:
        break

Submission status: Accepted

Solution code:
import sys
p = [r for r in sys.stdin.read().split('\n') if r != '']
n = int(p[0])
a = [int(c) for c in p[1].split()]
a.sort()
x = 1
t = 0
for i in reversed(a[1:]):
    t += i / x
    x *= 2
print(t / 2 + a[0] / x)

Submission status: Accepted

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

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

print(s)

Submission status: Accepted

Solution code:

n = int(input())
v = [int(i) for i in input().split()]
v.sort()
v1 = v.pop(0)
for i in range(n-1): 
  v2 = v.pop(0)
  v1 = (v1 + v2) / 2
print(v1)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
v = np.array(list(map(int,input().split())))
v_sort = np.sort(v)
temp = 0

for index in range(n-1):
  temp = (v_sort[0]+v_sort[1])/2
  v_sort = np.delete(v_sort,0)
  v_sort = np.delete(v_sort,0)
  v_sort = np.append(v_sort,temp)
  v_sort = np.sort(v_sort)

print(v_sort[0])

Submission status: Accepted

Solution code:

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

v.sort(reverse=True)
ave = v.pop()
while len(v) > 0:
	new = v.pop()
	ave = (ave + new)/2

print(ave)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int,input().split()))
sv = sorted(v, reverse=True)
var = 0
for k in range(N):
  if k == N-1:
    var = var + sv[k]/(2**(N-1))
  else:
    var = var + sv[k]/(2**(k+1))
print(var)

Submission status: Accepted

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

sum = 0.0
h = [0.0]*N

for i in range(2): #0, 1
    h[i] = ((0.5)**(N-1))*v[i]

for i in range(2,N):
    h[i] = ((0.5)**(N-i))*v[i]

for i in range(N):
    sum = sum + h[i]
    
print(sum)

Submission status: Accepted

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

print(V_max)

Submission status: Accepted

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

Submission status: Accepted

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

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

while len(V)>1:
    min1 = V.pop(-1)
    min2 = V.pop(-1)

    V.append((min1+min2)/2)
    V = sorted(V, reverse=True)

print(V[0])

Submission status: Accepted

Solution code:
n = int(raw_input())
v = map(int, raw_input().split())
new_v = sorted(v)
pre_v = new_v[0]
out = 0.0
for i in range(1,n):
    out = (pre_v + float(new_v[i]))/2.0
    pre_v = (pre_v + float(new_v[i]))/2.0
print(out)

Submission status: Accepted

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

Submission status: Accepted

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

def cal(x,y):
  return (x+y)/2

ans = cal(b[0],b[1])

if a >= 3:
  for i in range(a):
    i = i+2
    if i > a-1:
      break
    ans = cal(ans,b[i])
    
print(ans)

Submission status: Accepted

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

for _ in range(n-1):
    value=sorted(value)
    value_next=((value[0]+value[1])/2)
    value=value[2:]
    value.append(value_next)
print(value[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, v: "List[int]"):
    v.sort()

    while(len(v) != 0):
        if(len(v) == 1):
            x = v.pop(0)
            print(x)
            exit()
        a = v.pop(0)
        b = v.pop(0)
        v.append((a+b)/2)
        v.sort()
    

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    v = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, v)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

while len(v2)>0:
  if len(v2) == 1:
    print(v2[0])
    quit()
  new = (v2[0]+v2[1])/2
  v2.append(new)
  v2.pop(0)
  v2.pop(0)
  v2.sort()

Submission status: Accepted

Solution code:
def solve(n, l):
    for i in range(n-1):
        a = min(l)
        l.remove(min(l))
        b = min(l)
        l.remove(min(l))
        l.append((a + b)/2)
    return l

def main():
    n = int(input())
    l = list(map(int, input().split(" ")))
    print(*solve(n, l))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

arr = sorted(arr)

total = (arr[0] + arr[1])/2

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

print(total)

Submission status: Accepted

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


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

if N == 1:
    print(v[0])
elif N == 2:
    avg = (v[0] + v[1])/2
    print(avg)
else:
    v.sort()
    avg = (v[0] + v[1])/2
    for i in range(2,N):
        avg = (avg + v[i]) /2
    print(avg)

Submission status: Accepted

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

v.sort()

a = v[0]

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

print(a)

Submission status: Accepted

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

ans = 0

v.sort()

while len(v) != 0:
    if ans == 0:
        ans = (v[0]+v[1]) / 2
        v.pop(0)
        v.pop(0)

    else:
        ans = (ans+v[0]) / 2
        v.pop(0)
print(ans)

Submission status: Accepted

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

ave = val[0]
for v in val[1:]:
    ave = float((v + ave)/2)

print(ave)

Submission status: Accepted

Solution code:
_=input()
ans=0
for i,v in enumerate(sorted(list(map(int,input().split())))):
	ans+=v
	if i==0:continue
	ans/=2
print(ans)

Submission status: Accepted

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

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

while (len(aryNum) > 1):
    aryNum.sort()
    a = aryNum[0]
    b = aryNum[1]
    aryNum.remove(a)
    aryNum.remove(b)
    aryNum.append((a + b) / 2)

print(aryNum[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


def main():
    n = int(input())
    v_list = sorted([int(i) for i in input().split()])
    result = sum(v_list[:2]) / 2
    # 累積関数に(x+y/2)を渡すのがクールと思ったけど
    # 累積系関数の指定できるやつ忘れた
    for i in v_list[2:]:
        result = (result + i) / 2
    print(result)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

while len(V)>1:
  New=(V[0]+V[1])/2
  del V[0:2]
  V.append(New)
  V=sorted(V)

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#C
n = int(input())
v = list(map(int, input().split()))
while len(v) != 1:
    v.sort(reverse=True)
    t = (v.pop(), v.pop())
    v.append(sum(t)/2)
print(v[0])

Submission status: Accepted

Solution code:
n = int(input())

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

nums.sort()
# print(n,nums)

index = 0
while index < n-1:
    nums.append((float)(nums.pop(0)+nums.pop(0))/2)
    nums.sort()
    index = index + 1

print(nums.pop(0))

Submission status: Accepted

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

if N == 2:
  print((vi[0]+vi[1])/2)
else:
  i = 0
  while i < (N-1):
    new_number = (vi_sort[0]+vi_sort[1])/2
    del vi_sort[0:2]
    vi_sort.append(new_number)
    vi_sort.sort()
    i += 1
    
  print(vi_sort[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
value_list = [int(i) for i in input().split()]
value_list.sort()
for i in range(N-1):
    min1 = value_list[0]
    min2 = value_list[1]
    value_list.remove(min1)
    value_list.remove(min2)
    add = (min1+min2)/2
    value_list.append(add)
    value_list.sort()
print(value_list[0])

Submission status: Accepted

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

b = a.sort()

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

Submission status: Accepted

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

V = sorted(v)
summ = (V[0] + V[1])/2
for i in range(2, len(V)):
    summ = (summ + V[i])/2
print(summ)

Submission status: Accepted

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

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

for y in range(n - 2):
    max_value = (max_value + v[y + 2]) / 2

print(max_value)

Submission status: Accepted

Solution code:
import heapq

if __name__ == "__main__":
    # 入力
    N = int(input())
    v = list(map(int, input().split()))

    heapq.heapify(v)
    for i in range(N-1):
        a = heapq.heappop(v)
        b = heapq.heappop(v)
        heapq.heappush(v, float((a+b)/2))
    
    print(v[0])

Submission status: Accepted

Solution code:
import heapq

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

h = []
for v in V:
  heapq.heappush(h, v)

total = 0
for n in range(N - 1):
  x = heapq.heappop(h)
  y = heapq.heappop(h)
  a = (x + y) / 2
  heapq.heappush(h, a)
print(heapq.heappop(h))

Submission status: Accepted

Solution code:

from collections import deque

N = int(input())

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

V.sort()

V_deque = deque(V)

while len(V_deque) > 1:
    V1 = V_deque.popleft()
    V2 = V_deque.popleft()

    V_deque.append((V1 + V2)/2)

    V_list = list(V_deque)
    V_list.sort()
    V_deque = deque(V_list)

print(V_deque.popleft())

Submission status: Accepted

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

if __name__=="__main__":
    solve()

Submission status: Accepted

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

V.sort()
sum = 0
count = 0

for v in V:
    if count == 0:
        sum += v/(2**(N-1))
    else:
        sum += v/(2**(N-count))
    count += 1

print(sum)