Problem:


Score : 300 points

Problem Statement

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

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

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

Constraints

2 \leq N \leq 50

1 \leq v_i \leq 1000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
v_1 v_2 \ldots v_N

Output

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

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

Sample Input 1

2
3 4

Sample Output 1

3.5

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

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

Sample Input 2

3
500 300 200

Sample Output 2

375

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

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

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

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

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

Printing 375.0 and so on will also be accepted.

Sample Input 3

5
138 138 138 138 138

Sample Output 3

138



Sample input:
2
3 4


Sample output:
3.5

Submission status: Accepted

Solution code:
from collections import deque

N = int(input())
v = list(map(int, input().split()))
v.sort()
V = deque(v)
sum = 0
while True:
    sum = (V.popleft() + V.popleft())/2
    V.appendleft(sum)
    if len(V) == 1:
        break

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

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

print(ans)

Submission status: Accepted

Solution code:
import heapq

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

heapq.heapify(q)

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

print(heapq.heappop(q))

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

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

v = sorted(v)
a = v.pop(0)
b = v.pop(0)

result = (a + b)/2
while len(v) > 0:
    a = v.pop(0)
    b = result
    result = (a + b)/2

print(result)

Submission status: Accepted

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

for i in range(0,N-1):
    Ave=float((V[0]+V[1])/2)
    V.pop(0)
    V.pop(0)
    V.append(Ave)
    V=sorted(V)
print(V[0])

Submission status: Accepted

Solution code:
import math
n = int(input())
ni = [float(e) for e in input().split()]
ni.sort()
result = float(ni[0]+ni[1])/2.0

if n > 2:
	for i in range(2,n):
		result = float(result+ni[i])/2.0
	
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = sorted(list(map(int,(input().split()))))
i = 1
ans = A[0]

while i < N:
    ans = (A[i] + ans) / 2
    i += 1

print(ans)

Submission status: Accepted

Solution code:
import sys
inputs = sys.stdin.readlines()

n = int(inputs[0])
v_list = list(map(int, inputs[1].split()))
v = sorted(v_list)

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

Submission status: Accepted

Solution code:
# coding:utf-8
import sys
def main():
    N = int(input())
    lists = list(map(float, input().split()))
    lists.sort()

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

        for _ in range(2):
            lists.pop(0)

        lists.append(float(new_guzai))
        lists.sort()
        if len(lists) ==1:
            print(lists[0])
            sys.exit()


if __name__ == '__main__' :
    main()

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split()))
X = []
for i in range(N):
  X.append(V[i]-min(V))
def cal(V):
  A = 0
  for i in range(1,N+1):
    A += (sorted(V)[-i])/(2**(i))
  return A
print(cal(X) + min(V))

Submission status: Accepted

Solution code:

n = int(input())
v=sorted(list(map(int,input().split())))
while len(v) > 1:
	v[0] = (v[0] + v[1] ) /2
	del v[1]
## v = v[0].extend(v[2:])
 
  
print(float(v[0]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = input().split(" ")
A = [int(i) for i in A]
A = sorted(A)
#print(A)

for i in range(N-1):
    A[1] = (A[0] + A[1]) / 2
    A.pop(0)
    A = sorted(A)
    #print(A)
print(A[0])

Submission status: Accepted

Solution code:
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac

setrecursionlimit(1000000)


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

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Submission status: Accepted

Solution code:
n = int(input())
v_list = [int(x) for x in input().split()]
v_list.sort()
while len(v_list) > 1:
    a = v_list.pop(0)
    b = v_list.pop(0)
    v_list.insert(0, (a + b) / 2)
print(v_list[0])

Submission status: Accepted

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

Submission status: Accepted

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

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

v.sort()

sum  = v[0]
for w in v[1:]:
    sum = (sum + w) / 2

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

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

summax=0.0
for i in range(N-1):
    summax=summax+sortedV[i]/pow(2.0,i+1)
summax=summax+sortedV[N-1]/pow(2.0,N-1)

print(summax)

Submission status: Accepted

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

li.sort()
sum = 0
for i in range(n-1):
  li[0] =  (li[0] + li[1])/2
  del li[1]
print(li[0])

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
N = int(input())
values = input()

V = list()
V = values.split()
V_num = list()

for i in range(N):
    V_num.append(float(V[i]))

V_num.sort()

for i in range(N-1):
    min1 = V_num.pop(0)
    min2 = V_num.pop(0)
    V_num.append((min1+min2)/2)
    V_num.sort()

print(V_num[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# submission # - User: herp_sy
# https://atcoder.jp/contests/

import math
import statistics

# fact(int)
def fact(n):
  if(n == 1):
    return 1
  else:
    return (n * fact(n - 1))

# gcd(int,int)
def gcd(a,b):
  if a == 0:
    return b
  elif b == 0:
    return a
  else:
    return gcd(b,a % b)

# lcm(int,int)
def lcm(a,b):
  return (a * b / gcd(a,b))

# qsort(array[])
def qsort(seq):
  if len(seq) < 1:
      return seq
  pivot = seq[0]
  left = []
  right = []
  for x in range(1, len(seq)):
    if seq[x] <= pivot:
        left.append(seq[x])
    else:
        right.append(seq[x])
  left = qsort(left)
  right = qsort(right)
  foo = [pivot]
  return (left + foo + right)

# = map(int, input().split())
n  = int(input())
#  = raw_input().split()
v  = list(int(i) for i in input().split())  
lastguzai = 0.00

for i in range(n):
  vs = sorted(v)
  if len(v) == 2:
    lastguzai = (v[0] + v[1]) / 2.00
    break
  # print(vs)
  v = vs
  lastguzai = (v[0] + v[1]) / 2.00
  del v[0]
  del v[0]
  
  v.append(lastguzai)
  # print(v)

print('{:.6f}'.format(lastguzai))

Submission status: Accepted

Solution code:
n = int(input())

if n == 2:
    b, c = map(int, input().split())
    print((b + c) / 2)
else:
    s = list(map(int, input().split()))
    s.sort()
    k = s[0] / 2 ** (n - 1)
    for i in range (1, n):
        k = k + s[i] / 2 ** (n - i)
    
    print(k)

Submission status: Accepted

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

while n > 1:
	list = []
	for i in range(n-1):
		for j in range(i+1, n):
			sum = (v[i] + v[j])/2
			for k in range(n):
				if k != i and k != j:
					sum += v[k]
			list.append([i, j, sum])
	list.sort(key=lambda x : x[2])
	list.reverse()
	v[list[0][0]] = (v[list[0][0]]+v[list[0][1]])/2
	v[list[0][1]] = v[n-1]
	n -= 1
print(v[0])

Submission status: Accepted

Solution code:
n=int(input())
a=[]
for i in input().split():
  a.append(int(i))
a.sort()
for i in range(n-1):
  b=a.pop(0)
  c=a.pop(0)
  a.append((b+c)/2)
  a.sort()
print(a[0])

Submission status: Accepted

Solution code:
n = input()
vList = list(map(int, input().split()))
vList.sort()
s = sum(vList)
while len(vList) > 1:
    t = (vList[0] + vList[1]) / 2
    vList.pop(0)
    vList[0] = t
    s -= t
print(vList[0])

Submission status: Accepted

Solution code:
import numpy as np

N = input()
N = int(N)
stN = str(N)
p = input().split()
p_l = [int(s) for s in p]

p_sort = sorted(p_l,reverse=True)
#print(p_sort)
for i in range(0,N-1):
    x = p_sort.pop()
    y = p_sort.pop()
    z = (x+y)/2
    p_sort.append(z)
    #print(p_sort)

print(p_sort[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.0

print(v[n-1])

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int, input().split()))
li = sorted(li)
ans = 0 
for a, b in enumerate(li):
  if a == 0:
    ans += b 
  else:
    ans = (ans + b) / 2
    
print(ans)

Submission status: Accepted

Solution code:
N=int(input())

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

V.sort()
result = 0
for i in range(1,len(V)):
    if i == 1:
        result = (V[0] + V[1])/2
    else:
        result = (result + V[i])/2

print(result)

Submission status: Accepted

Solution code:
def A():
    a = int(input())
    s = str(input())
    if a<3200:
        print('red')
    else:
        print(s)

def B():
    n = int(input())
    a = input().split()
    s = 0
    for i in range(n):
        s += (1/int(a[i]))
    print(1/s)

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

    if n == 2:
        print((v[0]+v[1])/2)
        return

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

    print(v[-1])

C()

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
v=np.sort(list(map(int, input().split())))
v1=[]
v1.append(v[0]/2**(N-1)) 
for i in range(N-1):
    v1.append(v[i+1]/2**((N-1)-i))
print(sum(v1))

Submission status: Accepted

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

for i in range(n-1):
    a = min(arr)
    arr.remove(a)
    b = min(arr)
    arr.remove(b)
    arr.append((a+b)/2)
    
print(*arr)

Submission status: Accepted

Solution code:

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

v_list_sorted = sorted(v_list)

sum = 0
tmp_min = 0

if N == 1:
    print(v_list[0])
    exit(0)

for i in range(0, N - 1):
    if i == 0:
        merged = (v_list_sorted[i] + v_list_sorted[i + 1]) / 2.0
        tmp_min = merged
        sum = merged
    else:
        tmp_min = (tmp_min + v_list_sorted[i + 1]) / 2.0
print(tmp_min)

Submission status: Accepted

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

while len(v) != 2:
    v = [(v[0]+v[1])/2] + v[2:]
    n = len(v)
    
print(sum(v)/2)

Submission status: Accepted

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

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

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

print(tmp)

Submission status: Accepted

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

v.sort()

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

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

print(a)

Submission status: Accepted

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

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

print(sum/(2**(N-1)))

Submission status: Accepted

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

for i in range(n - 1):
    li.sort(reverse=True)
    small1 = li.pop()
    small2 = li.pop()
    li.append((small1 + small2) / 2)
print(li[0])

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

print(list[0])

Submission status: Accepted

Solution code:
n = int(input())
l = sorted([int(x) for x in input().split()])
coeff_l = [n-1] + [n-x for x in range(1,n)]
coeff_l = [1*0.5**n for n in coeff_l]
result = sum([a*b for a,b in zip(l,coeff_l)])
print(result)

Submission status: Accepted

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

def mean(a, b):
    return (a+b)/2

result = v[0]

for i in range(1, n):
    result = mean(result, v[i])

print(result)

Submission status: Accepted

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

for i in range(N-1):
  list.sort()
  num = (list[0] + list[1])/2
  list.pop(0)
  list.pop(0)
  list.insert(0, num)

print(list[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

V.sort()
V = list(reversed(V))

def insert(A, t):
  for i in range(len(A)):
    if A[i] <= t:
      A.insert(i, t)
      break
  else:
    A.append(t)

while(len(V) > 1):
  v1 = V.pop()
  v2 = V.pop()
  insert(V, (v1 + v2) / 2)

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
data = sorted(list(map(int, input().split())))
total = data.pop(0)
for i,num in enumerate(data):
    total += 2**i * num
print(total/2**(N-1))

Submission status: Accepted

Solution code:
from heapq import heappush, heappop

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

h = []

for v in v_list:
    heappush(h, v)

while len(h) >= 2:
    a = heappop(h)
    b = heappop(h)
    heappush(h, (a + b) / 2)

print(heappop(h))

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(map(int, input().split()))
ans = (v[0]+v[1]) / 2

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
value = [tuple(map(int,input().split())) for i in range(2)]
lis = []
new_v = 0

for i in range(value[0][0]):
    lis.append(value[1][i])

lis.sort()

for i in range(len(lis)-1):
    alch = (lis[i] + lis[i+1]) / 2
    lis[i+1] = alch

print(alch)

Submission status: Accepted

Solution code:
N=int(input())
v = [int(i) for i in input().split()] 
v.sort()
value=(v[0]+v[1])/2
j=0
hoge=[]
if N==2:
    print(value)
else:
    for i in range(2,N):
        value=(value+v[i])/2
    print(value)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
while len(a) > 1:
  res = (a[0] + a[1]) / 2
  a = a[2:] + [res]
  a.sort()
print(a[0])

Submission status: Accepted

Solution code:
from collections import defaultdict
import sys
import math
from datetime import datetime

def rec(S):
    if S is None: return 0
    elif len(S) == 1: return sum(S)
    elif len(S) == 2:
        return sum(S) / 2.0
    else: # len(S) >= 2
        S.sort()
        S[1] = (S[0] + S[1]) / 2.0
        return rec(S[1:])



def sol(n, S):
    return rec(S)



do_submit = True
#do_submit = False

def input_parse(input_str):
    lines = [x.strip() for x in input_str.split("\n") if x.strip()]
    parsed_lines = [list(map(str, line.split())) for line in lines]
    print(parsed_lines)
    n = int(parsed_lines[0][0])
    S = list(map(int, parsed_lines[1]))
    # S = parsed_lines[1][0]
    # return n, k, S
    return n, S


if not do_submit:
    n, S = input_parse("""
    3
    500 300 200
    """)
    print(sol(n, S))

    n, S = input_parse("""
    5
    138 138 138 138 138
    """)
    print(sol(n, S))




else:
    n = int(input().strip())
    S = list(map(int, input().split()))
    #S = input().split()
    # print(sol(n, k, S))

    #s = input().strip()
    # S = input().strip()
    print(sol(n, S))

Submission status: Accepted

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

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

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

print("{:.10f}".format(ans))

Submission status: Accepted

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

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

Submission status: Accepted

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


    b = sorted(a)
    c = (b[0]+b[1])/2
    

    for i in range(2,n):

        c = (c + b[i])/2
     
      
    print(c)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

for i in range(N)[1:N]:
  
  total.append(V[i] * 2**(i - 1))
print(sum(total) / 2 **(N - 1))

Submission status: Accepted

Solution code:
n = int(input())
value_list = sorted([ int(v) for v in input().split() ],reverse = True)
value_list = [ v / (2**i) for i, v in enumerate(value_list,1) ]
value_list[-1] *= 2
print(sum(value_list))

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

Submission status: Accepted

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

Submission status: Accepted

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

b, *not_mins = sorted(U)
for u in not_mins:
    b = (b + u) / 2

print(b)

Submission status: Accepted

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

if n == 2:
    print((ss[0] + ss[1]) / 2)
elif ss[0] == sum(ss) / n:
    print(ss[0])
else:
    for i in range(n - 1):
        if i == 0:
            tmp = (ss[i] + ss[i + 1]) / 2
        else:
            tmp = (tmp + ss[i + 1]) / 2
    print(tmp)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(a)-1):
    b = (a[0]+a[1])/2
    del a[0]
    del a[0]
    a.append(b)
    a.sort()
print(b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int,input().split()))
v_new = sorted(v)
ans=0.0
for i,x in enumerate(v_new):
  if i ==0 or i==1:
    ans += 1/2**(N-1)*x
  else:
    ans += 1/2**(N-i)*x
print(ans)

Submission status: Accepted

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

v.sort()

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

print(v[0])

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
for i in range(n-1):
    if len(v)>1:
        v.append((v.pop(v.index(min(v)))+v.pop(v.index(min(v))))/2)
print(v[0])

Submission status: Accepted

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

q = []
for i in range(N):
    heapq.heappush(q, L[i])

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

if len(q)==1:
    ans = heapq.heappop(q)
    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
vi = list(map(float,raw_input().split()))
vi.sort()

s = vi[0]/pow(2,n-1) + vi[1]/pow(2,n-1)
for i,v in enumerate(vi[2:]):
    s += v/pow(2,n-2-i)

print s

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

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

a.sort()
a.reverse()

for i in range(n-1):
    x = float(a.pop())
    y = float(a.pop())
    a.append((x + y)/2)

print(a.pop())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import queue

#+++++
		
def main():
	n = int(input())
	l = list(map(int, input().split()))
	ll=queue.PriorityQueue()
	for v in l:
		ll.put(v)

	while not ll.empty():
		ii=ll.get()
		nn=ll.get()
		nc=(ii+nn)/2
		if ll.empty():
			return nc
		ll.put(nc)
	
#+++++

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

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

res = min(A)
A.remove(min(A))

while(A != []):
  res = (res + min(A)) / 2
  A.remove(min(A))
  
print(res)

Submission status: Accepted

Solution code:
N=int(input())
x=[x for x in map(float,input().split())]
x.sort()
a=0
for i in range(N):
    if i==0 or i==1:
        a+=x[i]/2**(N-1)
    else:
        a+=x[i]/2**(N-i)
print(a)

Submission status: Accepted

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

bunshi = nums[0] + nums[1]
bunbo = pow(2, n - 1)

for idx in range(2, len(nums)):
    bunshi = bunshi + nums[idx] * pow(2, idx - 1)
print (bunshi/bunbo)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))
v.sort()
while not len(v) == 1:
  v[0] = (v[1] + v.pop(0))/2
print(v[0])

Submission status: Accepted

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

v.sort()
#print(v)
subtotal=(v[0]+v[1])/2

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

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:
def abc138_c():
    N = int(input())
    values = sorted(list(map(int, input().split())))

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

    print(values[0])

if __name__ == '__main__':
    abc138_c()

Submission status: Accepted

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

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

print(ans)

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

Submission status: Accepted

Solution code:
import functools

def gcd_list(numbers):
    return functools.reduce(fractions.gcd, numbers)


N = int(input())
ele_list = [int(i) for i in input().split(' ')]
ele_list.sort()

price = functools.reduce(lambda x,y: (x + y)/2, ele_list)
print (price )

Submission status: Accepted

Solution code:
from sys import stdin

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

    v = sorted(V)
    l = len(v)
    while l > 1:
        n = (v[0] + v[1]) / 2
        v = sorted(v[2:] + [n])
        l -= 1
    print(*v)

input = lambda: stdin.readline()
main()

Submission status: Accepted

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

while(len(l)>1):
    l = sorted(l)
    tmp = (l[0] + l[1])/2
    l.append(tmp)
    l.pop(0)
    l.pop(0)

print(l[0])

Submission status: Accepted

Solution code:
n = int(input())
num_list = sorted(list(map(int, input().split())))
def merge(num_list):
    if len(num_list) == 1: 
        return num_list
    if len(num_list) ==2: 
        return [(num_list[0] + num_list[1])/2]
    else:
        tmp = num_list[2:]
        tmp.append((num_list[0] + num_list[1])/2)
        return tmp

for i in range(n-1):
    num_list = sorted(merge(num_list))
print(num_list[0])

Submission status: Accepted

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

v = sorted(v)
# print(v)
def dfs (l):
    if len(l)==1:
         return l[0]
    num = (l[0]+l[1])/2.0
    l = l[2:]
    # print(l)
    l.append(num)
    # print(l)
    l = sorted(l)
    return dfs(l)



print(dfs(v))

Submission status: Accepted

Solution code:
N=int(input())
V=sorted(list(map(int,input().split())))
while True:
  try:
    V[0]=(V[0]+V[1])/2
    V.pop(1)
  except:
    break
print(V[0])

Submission status: Accepted

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

v.sort()

ans = v[0]

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

print(ans)

Submission status: Accepted

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

for i in range(n-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:
from heapq import heappush, heappop

N = int(input())
vLst = list(map(int, input().split()))
v = []
for i in range(N):
    heappush(v, vLst[i])

ans = 0
for i in range(N - 1):
    tmp1 = heappop(v)
    tmp2 = heappop(v)
    ans = float((tmp1 + tmp2) / 2)
    heappush(v, ans)

print(v[0])

Submission status: Accepted

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

v.sort()

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

print(s)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
N = int(input())
V = list(map(int, input().split()))
V.sort()
avg = V[0]
for i in range(1, N):
    avg = (avg + V[i]) / 2
print(avg)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(s) for s in input().split()]

A.sort()
tmp = (A[0] + A[1])/2
if N >= 3:
  for i in range(2, N):
    tmp = (tmp + A[i])/2

print(tmp)