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(reverse = True)
V.sort()
# print(V)
result = V[0]

for i in range(1, N):
	result = (V[i] + result) / 2.0
	# print(result)

print(result)

Submission status: Accepted

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

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

print(temp)

Submission status: Accepted

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

Submission status: Accepted

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

int_m=[]
tmp =0

for x in m:
  int_m.append(int(x))
  
int_m.sort()
for y in range (0,len(int_m)):
  tmp+=int_m[y]
  if y !=0:
    tmp /= 2
print(tmp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

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

a_sorted = sorted(a)

result = a_sorted.pop(0)
while a_sorted:
    a = a_sorted.pop(0)
    result = sum([a, result]) / 2
    if not a_sorted:
        print(result)

Submission status: Accepted

Solution code:

N = int(input())
vs  = sorted(list(map(int, input().split())))
ans = 0
ans = vs[0]+vs[1]
for i,v in enumerate(vs[2:]):
    ans += v*2**(i+1)
ans/=2**(N-1)
print(ans)

Submission status: Accepted

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

value.sort()
for i in range(n):
    if(i <= 1):
        continue
    value[i] = value[i] * pow(2, i-1)

con = sum(value) / pow(2, n-1)
print(con)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce

_ = input()
vs = sorted([int(v) for v in input().split()])

print(reduce(lambda r, v: (r + v) / 2, vs))

Submission status: Accepted

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

A.sort()

count = 0
X = 0


for i in A:
  if count == 0:
    count += 1
    X += i
    continue
  else:
    X = (X + A[count]) / 2
    count += 1

print(X)

Submission status: Accepted

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

N = input()
N = int(N)

v = []
v = input().split()
#print(v)
v = [float(n) for n in v]
#print(v)
v.sort()
#print(v)

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

#print(v)
print(v[N - 1])

Submission status: Accepted

Solution code:
#coding: utf-8

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

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

print (V[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
u = list(map(int,input().split()))
s_u = sorted(u)
for x in range(N-1):
  s_u = sorted(s_u)
  tmp = s_u.copy()
  val = (s_u[0] + s_u[1]) / 2
  if len(s_u) != 1:
    s_u.remove(tmp[0])
    s_u.remove(tmp[1])
  else:
    s_u.remove(tmp[0])
  s_u.insert(0,val)
print(s_u[0])

Submission status: Accepted

Solution code:
a = int(input())
b= [int(s) for s in input().split()]
b=sorted(b)

t = (b[0] + b[1])/2

if a!=2:
	for i in range(a-2):
  		k = (t + b[i+2])/2
  		t=k

print(t)

Submission status: Accepted

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

n=input()
v=[int(x) for x in list(input().split())]
v.sort()
value=v[0]
for i in range(len(v)-1):
    value=(v[i+1]+value)/2

print(value)

Submission status: Accepted

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

sv = sorted(v)

for i in range(n-1):
    new = (sv[0] + sv[1]) / 2
    if(i == n-1):
        break
    
    else:
        sva = sv[2:]
        sva.append(new)
        sv = sorted(sva)

print(sv[0])

Submission status: Accepted

Solution code:
N = int(input())
v = input().split()
v.sort(key=float)

i = 0
while i <= N-2:
  v[i+1]=(float(v[i])+float(v[i+1]))/2
  i += 1
  

print(v[i])

Submission status: Accepted

Solution code:
N = int(input())

#v = []#[500, 300, 200]
v = [float(s) for s in raw_input().split()]

for i in range(len(v) - 1):
    v.sort(reverse=True)
    _mean = (v.pop() + v.pop())/2.0
    v.append(_mean)

print(v[0])

Submission status: Accepted

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

# 整数の入力
N = int(raw_input())

# 空白区切りの整数を取得
li = map(int, raw_input().split())

# 降順ソート
li.sort(reverse=True)

# 最小値同士を計算した結果を末尾に格納
for i in xrange(N-1,0,-1):
    tmp = float(li.pop(i) + li.pop(i-1))/2
    li.append(tmp)

print tmp

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

from heapq import heappush, heappop

h = []
for a in v:
    heappush(h, a)

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

print(h[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
num = int(input())
lines = input().split(" ")
int_lines = [int(i) for i in lines]
int_lines.sort()
count = 1
 
if num == 2:
  result = (int_lines[0] + int_lines[1]) / 2
  print(result)
else:
  itr = iter([j for j in int_lines])
  for j in itr:
    if count == 1:
        x = j
        count += 1
    elif count == 2:
        y = j
        count += 1
    else:
        x = (x + y) / 2
        y = j
        count += 1
  x = (x + y) / 2
    
  print(x)

Submission status: Accepted

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



for i in range(N-1):
# 1回錬金
    Vs.sort()
    a = Vs.pop(0)
    b = Vs.pop(0)
    Vs.append((a+b)/2)

print(Vs[0])

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

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

sv = sorted(v)

ans = 0

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

print(ans)

Submission status: Accepted

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

for i in range(N):
    v[i] = float(v[i])
    
v.sort()
ite = 0
while(ite < N-1):
    v[ite+1] = (v[ite]+v[ite+1])/2
    v[ite] = 0
    v.sort()
    #print(v)
    ite += 1

print(v[-1])

Submission status: Accepted

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

# input
n = int(input())
numbers = map(int, input().split())

ans = [[0] * n for i in range(n)]

numbers = sorted(numbers, reverse=False)

for x, i in enumerate(numbers):
    ans[0][x] = i 

#print("input to for")
#print(ans)

for x, ansc in enumerate(ans):
    #print("x times")
    #print(x)
    if ansc.count(0) == n - 1:
        print(ansc[n-1])
        break
    for y, i in enumerate(ansc):
        if i != 0 and y == 0:
            #print("first run")
            ansc[1] = (float(ansc[0]) + ansc[1]) / 2
            ansc[0] = 0
            break
        else:
            #print("second run")
            if y > 0:
                if ansc[y-1] == 0 and ansc[y] != 0:
                    ansc[y+1] = (float(ansc[y]) + ansc[y+1]) / 2
                    ansc[y] = 0
                    break
        #print("y=")
        #print(y)
        #print(ansc)
    #print("before")
    #print(ans)
    ans[x+1] = sorted(ans[x+1], reverse=False, key=float)
    ans[x+1] = ansc

Submission status: Accepted

Solution code:
import numpy
from functools import reduce
N = int(input())
a = list(map(float, input().split()))
a = numpy.sort(a)
print(reduce(lambda x, y: (x + y) / 2, a))

Submission status: Accepted

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

ev = 0
count = 1

while count > 0:
  count = 0
  i = 0
  while i+1 in range(row):
    if array[i] > array[i+1]:
      ev = array[i] 
      array[i] = array[i+1]
      array[i+1] = ev
      count += 1
    else:
      i += 1

i = 0
Ans = array[i]
while i < row:
  if i == 0:
    Ans = array[i]
  else:
    Ans = (Ans + array[i]) / 2
  i += 1

print(Ans)

Submission status: Accepted

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

v.sort()

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

print(sum/float((2**(n-1))))

Submission status: Accepted

Solution code:
def alche(n, v):
    if n == 2:
        x = (v[0] + v[1]) / 2
        print(x)
    else:
        v.sort()
        w = []
        w.append((v[0] + v[1]) / 2)
        for i in range(2, n):
            w.append(v[i])
        n -= 1
        alche(n, w)

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

alche(n, v)

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 solve():
    v = read()
    result = think(v)
    write(result)


def read():
    n = read_int(1)[0]
    return read_int(n)


def read_int(n):
    return list(map(lambda x: int(x), read_line().split(' ')))[:n]


def read_float(n):
    return list(map(lambda x: float(x), read_line().split(' ')))[:n]


def read_line(n=0):
    if n == 0:
        return input().rstrip()
    else:
        return input().rstrip()[:n]


def think(v):
    local_v = list(v)
    local_v.sort()
    return recursive_call(local_v, 0, len(local_v) - 1, {})


def recursive_call(vector, from_index, to_index, cache):
    # print('{0:s}, {1:d}, {2:d}, {3:s}'.format(str(vector), from_index, to_index, str(cache)))
    key = '{0:d},{1:d}'.format(from_index, to_index)
    if key in cache:
        return cache[key]
    if to_index - from_index <= 1:
        value = (vector[from_index] + vector[to_index]) / 2
        cache[key] = value
        return value
    merged_vector = list(vector)
    elem_1 = merged_vector.pop(from_index)
    elem_2 = merged_vector.pop(from_index)
    merged_vector.insert(from_index, (elem_1 + elem_2) / 2)

    value_1 = recursive_call(merged_vector, from_index, to_index - 1, cache)
    value_2 = (elem_1 + recursive_call(vector, from_index + 1, to_index, cache)) / 2
    result = max(value_1, value_2)
    cache[key] = result

    return result


def write(result):
    print(result)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N = int(input())

*V, = map(int, input().split())

V.sort(reverse=True)

dp = [0]*N



for i in range(N-1):
    z = (V[len(V)-2]+V[len(V)-1])/2
    dp[i+1] = dp[i] + z
    #print(dp[i],z)
    #print(V)
    V.pop()
    V.pop()
    V.append(z)
    V.sort(reverse=True)


#print(dp[N-1])
print(V[0])

Submission status: Accepted

Solution code:
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; cnt = 0; ansli = []; tmpli = []; candili = []; stillset = set()
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def s_list(): return list(input())
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def num__grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]#NumberGrid
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def grid(n): return [s_list() for _ in range(n)]

n = i()
v = wi()
v.sort()
k = v[0]

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

print(k)

Submission status: Accepted

Solution code:
N=int(input())
v=[int(x) for x in input().split()]
cnt=0
while cnt<N-1:
    v.sort()
    v[0]=(v[0]+v.pop(1))/2
    cnt+=1
print(v[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
i = len(v)-1

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

print(new_num)

'''
    for j in range((n-1)-i):
        if j == 0:
            v[j] = new_num
        else:
            v.remove(v[len(v)-1])

'''

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    v = sorted(list(map(int, input().split())))
    while len(v) > 2:
        new_v = [sum(v[:2]) / 2] + v[2:]
        v = new_v
    print(sum(v) / 2)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import functools

_, v = int(input()), sorted(map(int, input().split()))
v_max = functools.reduce(lambda a, b: (a + b) / 2, v, v[0])
print(v_max)

Submission status: Accepted

Solution code:
N = int(input())

v = list(map(int,input().split()))
         
if N == 2:
  print(sum([int(i) for i in v])/2)
  exit()
  
else:
  v.sort()
  a = v[-1]
  v.pop(-1)
  r = (v[0]+v[1])/2
  for i in range(N-3):    
    r = (r+v[i+2])/2 
    
print((r+a)/2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = V[0]

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

print(ans)

Submission status: Accepted

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

V.sort()
V_sum = (V[0] + V[1]) / 2

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

print(V_sum)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
v.sort(reverse=True)
ans=v.pop()
while v:
  tmp=v.pop()
  ans=(ans+tmp)/2

print(ans)

Submission status: Accepted

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

    
print(max(v_list))

Submission status: Accepted

Solution code:
N=int(input())
A=input().split(" ")
A=[int(i) for i in A]
A.sort()
 
ans=A[0]/(2**(N-1))
for i in range(1,N):
  ans+=A[i]/(2**(N-i))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

v.sort()

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
v_list = list(map(int, input().split()))

v_list.sort(reverse=True)

for i in range(len(v_list) - 1):
    append_num = (v_list.pop() + v_list.pop()) / 2
    v_list.append(append_num)

print(v_list[0])

Submission status: Accepted

Solution code:
n = int(input())
v_s = [int(a) for a in input().split()] 

v_s.sort()

first = True
for v in v_s:
  if first:
    ans = v
    first = False
  else:
    ans = (v + ans) / 2
    
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = sorted(list(map(int, input().split())))
l = []

for i in range(N):
  l.append(2**(i+1))

l = sorted(l, reverse = True)
  
array_multiple = list(map(lambda x,n: x/n, A, l))

print(sum(array_multiple)+A[0]/(2**N))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()
A = list(map(int, input().split()))
A.sort()
while len(A)>1:
  b = A[0:2]
  c = sum(i for i in b)
  A.append(c/2)
  del(A[0:2])
  A.sort()
z = [str(a) for a in A]
z = ''.join(z)
print(z)

Submission status: Accepted

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

for i in range(N):
    if len(v) == 1:
        pass
    else:
        if min(v) in v:
            aaa =min(v)
            v.remove(min(v))
        if min(v) in v:
            bbb =min(v)
            v.remove(min(v))
            ccc =(aaa + bbb)/2
            v.append(ccc)
print(v[0])

Submission status: Accepted

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

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

v.sort(reverse=False)

temp = v[0]

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

print(temp)

Submission status: Accepted

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

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

print(tmp)

Submission status: Accepted

Solution code:
import sys
N = int(input())
v = list(map(int,input().split()))
max_num = max(v)
v.remove(max(v))

if N >2:
	x = min(v)
	v.remove(min(v))
	y = min(v)
	v.remove(min(v))
	value = (x+y)/2
	# print(x,':',y,'→',value)
	while len(v) != 0:
		target = value
		value = (value+min(v))/2
		# print(target,':',min(v),'→',value)
		v.remove(min(v))

	print((value+max_num)/2)
	sys.exit()

else:
	print((max_num+v[0])/2)
	sys.exit()

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
 
for i in range(n-1):
  mn1 = min(v)
  v.remove(min(v))
  mn2 = min(v)
  v.remove(min(v))
  v.append((mn1 + mn2) / 2.0)
 
print(v[0])

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n - 1):
    v[-2] += v[-1]
    v[-2] /= 2
    v.pop(-1)
    v.sort(reverse=True)

print(v[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N_number = int(input())
values = list(map(int,input().split()))
values.sort()
for i in range(N_number-1):
  new_value = (values[0]+values[1]) / 2
  values = values[2:]
  values.insert(0, new_value)

print(values[0])

Submission status: Accepted

Solution code:
n=int(input())
nu=list(map(int,input().split()))
num=sorted(nu)
a=num.pop(0)
b=num.pop(0)
c=(a+b)/2
for i in range(n-2):
    x=num.pop(0)
    c=(c+x)/2
print(c)

Submission status: Accepted

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

li.sort()
a = li[0] 

if n >=2:
    for i in range(1,n-1):
        a = (a + li[i])/2
        
print((a+li[-1])/2)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(V[0])

Submission status: Accepted

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

v.sort()

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

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

print(temp)

Submission status: Accepted

Solution code:
import heapq

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

heapq.heapify(v)
while len(v) > 1:
    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())
v= list(map(int,input().split()))
v2 = sorted(v)
S = v2[0]/2**(N-1)
for i in range (N-1):
  S += v2[i+1]/2**(N-1-i)
print(S)

Submission status: Accepted

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

Submission status: Accepted

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

def saiki(*v):
    #print(*v)
    if len(v) == 1:
        return v
    elif len(v) == 2:
        return sum(v)/2
    else:
        return (saiki(*v[1:]) + v[0])/2

print(saiki(*v))

Submission status: Accepted

Solution code:
n=input()
arr=map(float,raw_input().split())
if n==2:
        print (arr[0]+arr[1])/2
else:
        arr.sort()
        tot=arr[0]+arr[1]
        c=2
        for i in range(2,n):
                tot+=c*arr[i]
                c*=2
        print tot/pow(2,n-1)

Submission status: Accepted

Solution code:
from functools import reduce
n = int(input())

v = sorted(map(int, input().split()))
ans = reduce(lambda a, b: (a+b)/2, v)
print(ans)

Submission status: Accepted

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

V.sort()
t = 0.0

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

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input()) #数値
V =[int(i) for i in input().split()] #数値


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

Submission status: Accepted

Solution code:
import heapq


def solve(N, v):
    h = v[:]
    heapq.heapify(h)
    while len(h) > 1:
        x = heapq.heappop(h)
        y = heapq.heappop(h)
        #print(x, y)
        heapq.heappush(h, (x + y) / 2)
    return h[0]


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

while len(v) != 1:
    mx = min(v)
    v.remove(min(v))
    mn = min(v)
    v.remove(min(v))
    v.append((mx+mn)/2)
print(v[0])

Submission status: Accepted

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

print(ave)

Submission status: Accepted

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

def cal(v):
  if len(v) == 1:
    return v[0]
  else:
    vv = v
    vv.sort()
    vv.reverse()
    vv_max = vv[0]
    vv.pop(0)
    return (cal(vv)+vv_max)/2

print(cal(v))

Submission status: Accepted

Solution code:
n = input()

gu = [int(e) for e in input().split()]

gu.sort()

gunew = gu[0]

for i in gu :
    gunew = (gunew + i) / 2

print(gunew)

Submission status: Accepted

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

v_new = sorted(v)

while len(v_new) > 1:
 	v_new[0] = ((v_new[0] + v_new[1]) / 2)
 	
 	for i in range(len(v_new) - 2):
 		v_new[ i + 1 ] = v_new[ i + 2 ]

 	#末尾 を削除
 	del v_new[-1]	

print(v_new[0])

Submission status: Accepted

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

v.sort(reverse=True)

while len(v) > 1:
    v = v[:-2] + [(v[-1] + v[-2]) / 2]

print(v[0])

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

# 小さい方からまとめていく

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

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

Submission status: Accepted

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


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

print(V.pop())

Submission status: Accepted

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

for i in list:
  if x == 0:
    x = i
  else:
    x = (x + i)/2
print(x)

Submission status: Accepted

Solution code:
n = input()
nums_str = input()
num_str_list = nums_str.split(" ")
num_list = list(map(lambda x: int(x), num_str_list))
num_list.sort()

temp = num_list[0]
num_list.pop(0)
for num in num_list:
    temp += num
    temp /= 2

print(temp)

Submission status: Accepted

Solution code:
A = int(input())
B = list()
tmp = 0
#for i in range(A):
B= input().split()
C = list(map(int, B))
D = sorted(C)
#print(D)
tmp = D[0]
#print(range(A-1))
for i in range(A-1):
    tmp = (tmp + D[i+1])/2
print(tmp)

Submission status: Accepted

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

v_sorted = sorted(v)
average = 0

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

print(v_sorted[-1])

Submission status: Accepted

Solution code:
N=int(input())
As=[float(x) for x in input().strip().split(" ")]
As=sorted(As)
def mix(As):
    if len(As) == 2:
        return (As[0] + As[1])/2
    a=As.pop()
    return (a+mix(As))/2
print(mix(As))

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

v_l.sort()

bunshi=v_l[0]
bunbo=2**(n-1)


for i in range(1,n):
    bunshi += v_l[i]*(2**(i-1))
    
print(bunshi/bunbo)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input(""))
v = input("").split(" ")
for i in range(n):
    v[i] = int(v[i])
v.sort()
while len(v) != 1:
    new_value = (v[0] + v[1]) / 2
    v.append(new_value)
    v.remove(v[0])
    v.remove(v[0])
    v.sort()

print(v[0])

Submission status: Accepted

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

Submission status: Accepted

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

temp = 0
sum_ = 0

for i in range(1,n):
    if i == 1:
        temp += decimal.Decimal((v[0] + v[1])/2)
    else:
        temp = decimal.Decimal((temp + v[i])/2)

print(temp)

Submission status: Accepted

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

for i in range(0 , n-1):
    if (i != 0):
        result = (result + sortedListV[i+1]) / 2
    else:
        result = (sortedListV[i] + sortedListV[i+1]) / 2
print(result)