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:
import math
from collections import deque
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq

n = readInt()
v = readInts()

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 = sorted(list(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(reverse=True)
while len(v) > 1:
  num1 = v.pop()
  num2 = v.pop()
  result = (num1 + num2) / 2
  v.append(result)
  v.sort(reverse=True)
print(v[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

n, *lst = map(int, sys.stdin.read().split())
lst.sort()
res = lst[0]
for v in lst[1:]:
  res = (res + v) / 2
print(res)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
vs = sorted(list(map(int, input().split())))
while N > 1:
  v = vs.pop(0)
  N -= 1
  
  vs[0] = (v + vs[0])/2

print(vs[0])

Submission status: Accepted

Solution code:
import sys
from fractions import gcd
N=int(sys.stdin.readline().strip())
A=map(int, sys.stdin.readline().split())
A.sort()

ans=float(A[0]+A[1])/2
for i in range(2,N):
    a=A[i]
    ans=float(ans+a)/2
print ans

Submission status: Accepted

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

v.sort()
ans = v[0]
for i in range(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()

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

Submission status: Accepted

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

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

print(v[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
v=sorted(v)
while True:
    x=v.pop(0)
    y=v.pop(0)
    v.append((x+y)/2)
    v=sorted(v)
    if len(v)==1:
        break
print(*v)

Submission status: Accepted

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

cnt = 0
while cnt < N-1:
    v[1] = (v[0]+v[1]) / 2
    del v[0]
    cnt +=1
print(*v)

Submission status: Accepted

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

print(a)

Submission status: Accepted

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

while len(v)>1:
	a=(v[0]+v[1])/2
	del v[0]
	v[0]=a
print(*v)

Submission status: Accepted

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

V.sort()
ans = 0

for count,i in enumerate(V):
  if count == 0 or count == 1:
    ans += i / (2**(N-1))
  else:
    ans += i / (2**(N-count))
else:
  print(ans)

Submission status: Accepted

Solution code:
input()
v = list(map(int, input().split()))
v.sort()
ans, *v = v
for vi in v:
    ans = (ans + vi) / 2
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
List = list(map(int, input().split()))
List.sort()
ans=0
i=0
while i<N:
    if i==0:
        pass
        ans=List[i]
    else:
        ans=(List[i]+ans)/2
    i+=1
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
V = sorted(list(map(int, input().split())))
a = V[0]
for i in range(1,n):
    a = (a +  V[i])*0.5

print(a)

Submission status: Accepted

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

# check
for n in range(N - 1):
    v.sort()
    mix = (v[0] + v[1]) / 2
    append(mix)
    del v[0:2]

print(v[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(N-1):
    x=(v[0]+v[1])/2
    V=deque(v)
    V.popleft()
    V.popleft()
    V.append(x)
    v=list(V)
    v.sort()
print(v[0])

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())
    V = [int(i) for i in readline().split()]

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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()))
while len(v) > 1:
    v = sorted(v)
    v = [(v[0] + v[1]) / 2, ] + v[2:]
print(v[0])

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
n = int(input())
v = list(map(int, input().split()))
v.sort()

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

print(sum)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int,input().split()))
v = sorted(v)
for i in range(N-1):
  if(i == 0):
    tmp = v.pop(0)
    tmp2 = v.pop(0)
    ave = (tmp+tmp2)/2
    tmp = tmp2
  else:
    tmp2 = v.pop(0)
    ave = (ave+tmp2)/2
print(str(ave))

Submission status: Accepted

Solution code:
import itertools

n = int(input())
v = sorted(map(int, input().split()))
num = v[0]

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

print(num)

Submission status: Accepted

Solution code:
def main():
    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
    return a
print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())

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

a.sort()

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

Submission status: Accepted

Solution code:
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)
    v.sort(reverse=True)
print(v[0])

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def SS(): return map(str,sys.stdin.readline().rstrip().split())
def II(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
v = LI()
v.sort()
ans = v.pop(0)

for i in v:
  ans = (ans+i)/2
print(ans)

Submission status: Accepted

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

V.sort()
reg = [V[0]]

for i in range(1, N):
    tmp = (V[i] + reg.pop())/2
    reg.append(tmp)
print(reg.pop())

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect


def main():
    n = int(input())
    A = list(map(int, input().split()))
    A.sort()
    for i in range(1, n):
        A[i] = (A[i] + A[i-1]) / 2
    print('%.10f' % (A[-1]))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

v.sort()

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

print(v[0])

Submission status: Accepted

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

v.sort()
tmp = v[0]

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

Submission status: Accepted

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

print(V[-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int,input().split()))
v=sorted(v,key=int)
def fusion():
    if len(v)==1:
        return v[0]
    else:
        v.insert(0,(v.pop(0)+v.pop(0))/2)
        v.sort(key=float)
        return fusion()
print(fusion())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

v = sorted(v)

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

print(res)

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math
def py():
    print("Yes")
def pn():
    print("No")
def iin():
    x = int(input())
    return x

neko = 0
nya = 0
nuko = 0

n = iin()
a = [int(x) for x in input().split()]
for i in range(n-1):
    a.sort()
    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()

material = [v[i]*(2**(i-n)) for i in range(n)]
print(sum(material) + material[0])

Submission status: Accepted

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

Vs.sort()

ans = Vs[0]
for V in Vs[1:]:
    ans = (ans+V)/2

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC138C

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

Submission status: Accepted

Solution code:
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

def resolve():
    N,=pin()
    v=lispin()
    V=[v_*2 for v_ in v]
    V.sort()
    ans=V[0]
    for i in range(1,N):
        ans=(ans+V[i])/2
    print(ans/2)

#%%submit!    
resolve()

Submission status: Accepted

Solution code:
from collections import deque
N = int(input())
v = list(map(int, input().split()))

v = sorted(v)
v = deque(v)


for i in range(N - 1):
    cal = 0
    cal += v.popleft()
    cal += v.popleft()
    cal = cal / 2
    v.appendleft(cal)

print(v.pop())

Submission status: Accepted

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

V = sorted(V)

while True:
    if len(V) == 1:
        break
    new = (V[0]+V[1])/2
    V = V[2:]
    V.append(new)
    V = sorted(V)

print(V[0])

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())), reverse=True)
for _ in range(n-1):
    new_v = (v.pop() + v.pop()) / 2
    v.append(new_v)
    v = sorted(v, reverse=True)
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=[]
v+=list(map(int,input().split()))
v.sort()
l=len(v)
result=v[0]/(2**(l-1))
for i in range(1,n):
  result=result+v[i]/(2**(l-i))
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq


def main():
    _ = input()
    A = list(map(int, input().split()))
    heapq.heapify(A)

    while len(A) > 1:
        n1 = heapq.heappop(A)
        n2 = heapq.heappop(A)
        n = (n1 + n2) / 2
        heapq.heappush(A, n)

    print(sum(A))


if __name__ == '__main__':
    main()

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:
import heapq

def main():
    N = int(input())
    v = list(map(int, input().split()))
    heapq.heapify(v)
    for i in range(N-1):
        x = heapq.heappop(v)
        y = heapq.heappop(v)
        heapq.heappush(v, (x+y)/2)
    ans = heapq.heappop(v)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(s)

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[-1])

Submission status: Accepted

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

V = sorted(v)

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

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

if __name__ == '__main__':
    main()

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

Submission status: Accepted

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

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

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

print(a)

Submission status: Accepted

Solution code:
import heapq
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,(a+b)/2)
ans=heapq.heappop(v)
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
v = list(map(int, input().split()))
v_sort = np.array(np.sort(v))
x = np.zeros(N)
x[0] = 2**(N-1)
for i in list(range(1,N)):
    x[i] = 2**(N-i)
y = v_sort/x
print(sum(y))

Submission status: Accepted

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

Submission status: Accepted

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

while len(V) > 1:
    V.append((V.pop(0) + V.pop(0)) / 2)
    V = sorted(V)

print(*V)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n = I()
V = LI()
V.sort()
tmp = V[0]
for v in V:
    tmp = (tmp + v) / 2

print(tmp)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

v.sort()

value = v[0]

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

print(value)

Submission status: Accepted

Solution code:

n=int(input())
v=sorted(list(map(int,input().split())),reverse=True)
# print(v)

max_v=0
for i in range(n-1):
    max_v+=v[i]*((0.5)**(i+1))

max_v+=v[-1]*0.5**(n-1)
print(max_v)

Submission status: Accepted

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

Submission status: Accepted

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


for i in range(len(v_list) - 1):
    v_list[i + 1] = (v_list[i] + v_list[i + 1]) / 2
    # print(f"{i}: {v_list}")

print(v_list[-1])

Submission status: Accepted

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

sum = 0
a = 0

if N == 1:
    sum += v_list[0]

elif N == 2:
    sum += (v_list[0] + v_list[1])/2

else:
    sum += (v_list[0] + v_list[1]) * 2 ** (-N + 1)
    for i in range(N-2):
        sum += v_list[i+2] * 2 ** (-N + i + 2)
        
print(sum)

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
v = list(map(int, input().split()))
v.sort()
ans = 0
i = 0
while i < N - 1:
    v[i+1] = (v[i] + v[i+1]) /2
    i += 1
print(v[N-1])

Submission status: Accepted

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

s=sorted(v)

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

a = sorted(a,reverse=True)
while len(a)>1:
  a.append((a.pop()+a.pop())/2)
print(a[0])

Submission status: Accepted

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

ans =v[0]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

v = sorted(v, reverse=True)

while True:
    l = len(v)
    a = v.pop()
    b = v.pop()
    mid = (a+b)/2
    v.append(mid)
    v = sorted(v, reverse=True)
    if l==2:
        break

print(sum(v))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

V.sort()

ans = 0
ans += V[0]/(2**(N-1))

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

print(ans)

Submission status: Accepted

Solution code:
# C - Alchemist

N = int(input())
V = sorted([int(v) for v in input().split()])
while len(V) != 1:
    v1 = V.pop(0)
    v2 = V.pop(0)
    V = [(v1 + v2) / 2] + V

print(V[0])

Submission status: Accepted

Solution code:
import heapq

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

heapq.heapify(v)

res = 0
for _ in range(N-1):
  a = heapq.heappop(v)
  b = heapq.heappop(v)
  res = (a+b)/2
  heapq.heappush(v, res)
    
print(res)

Submission status: Accepted

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

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

    print(_v)


resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())

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

v.sort()

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

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

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

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

v = sorted(v)



values = [v[i]/(2**(N-i)) for i in range(N)]
values[0] = values[0]*2
print(sum(values))

Submission status: Accepted

Solution code:
import sys, heapq

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

heapq.heapify(V)

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

print(V[0])

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

C = sorted(V)

ans = 0
a = C[0]
for i in range(1, N):
    a = (a + C[i]) / 2
ans = max(ans, a)
print(ans)

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.pop(1))/2
    V = sorted(V)

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    v = [int(x) for x in input().split()]
    while len(v) > 1:
        v.sort()
        a = v[0]
        b = v[1]
        v.pop(0)
        v.pop(0)
        new = (a + b) / 2
        v.append(new)
    print(v[0])


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    values = list(map(int, input().split(' ')))
    values.sort(reverse=True)
    div = 1
    answer = 0
    for v in values[:-1]:
        div *= 2
        answer += v / div
    answer += values[-1] / div
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    #a,b,c=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    n=int(readline())
    vv=list(map(int, readline().rstrip().split()))
    vv.sort()
    for i in range(1,n):
        vv[i]=(vv[i-1]+vv[i])/2
    print(vv[n-1])
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Accepted

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

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

print(h)

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:
import heapq

n = int(input())
v = list(map(int, input().split()))
heapq.heapify(v)
while len(v) > 1:
  x = heapq.heappop(v)
  y = heapq.heappop(v)
  heapq.heappush(v, (x + y) / 2.0)

res = heapq.heappop(v)
print("{:.6f}\n".format(res))