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:
#!/usr/bin/env python3
import sys


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

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


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    v = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, v)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

lis_v.sort()
while len(lis_v) != 1:
    base = lis_v.pop(0)
    lis_v[0] = (lis_v[0] + base)/2

print(lis_v[0])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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[N-1])

Submission status: Accepted

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

vlist.sort()

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

print(vlist[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#a,b=map(int,input().split())
#p_3,p_4=map(int,input().split())
n=int(input())
#g=input()
#recipe=[list(input().split())for _ in range(n)]
#m=int(input())
#have=[list(input().split())for _ in range(m)]
#s=[list(input())for _ in range(n)]
#h=list(map(int,input().split()))
v=list(map(int,input().split()))
#c=list(map(float,input().split()))
#n=int(input())
#s=[list(map(int,input().split()))for _ in range(n)]
#s=[list(input().split())for _ in range(n)]
#s=[input()for _ in range(n)]
v.sort()
ans=v[0]
for i in range(1,n):
    ans=(ans+v[i])/2
print(ans)

Submission status: Accepted

Solution code:
#a,b=map(int,input().split())
#p_3,p_4=map(int,input().split())
n=int(input())
#g=input()
#recipe=[list(input().split())for _ in range(n)]
#m=int(input())
#have=[list(input().split())for _ in range(m)]
#s=[list(input())for _ in range(n)]
#h=list(map(int,input().split()))
v=list(map(int,input().split()))
#c=list(map(float,input().split()))
#n=int(input())
#s=[list(map(int,input().split()))for _ in range(n)]
#s=[list(input().split())for _ in range(n)]
#s=[input()for _ in range(n)]
v.sort()
ans=0
ans+=v[0]/2**(n-1)
j=n-1
for i in range(1,n):
    ans+=v[i]/2**j
    j-=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq

N = int(raw_input())
v = list(map(int,raw_input().split()))
heapq.heapify(v)
for i in range(0,N-1):
  v1 = heapq.heappop(v)
  v2 = heapq.heappop(v)
  
  heapq.heappush(v, (v1+v2)/float(2))
print v[0]

Submission status: Accepted

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

#後で合成するものの影響力が大きいので、
#大きい数を後で合成する？

#昇順
v.sort()

while len(v) > 1:
  # 最小の2つを合成してappend
  v.append((v[0] + v[1]) / 2)
  # 合成した2つを除去しsort
  v = v[2:]
  v.sort()

print(v[0])

Submission status: Accepted

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

from heapq import *
n=int(input())
v=map(int,input().split())
u=[]
for i in v:
  heappush(u,i)
#print(u)
for j in range(n-1):  
  a1=heappop(u)
  a2=heappop(u)
  ave=(a1+a2)/2
  heappush(u,ave)
print(u[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):
  v.append((v.pop() + v.pop()) / 2)
  
print(v[0])

Submission status: Accepted

Solution code:
from heapq import heapify, heappop, heappush
N = int(input())
v = [int(i) for i in input().split()]

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
number =int(input())
powers =input().rstrip().split()
#print(number)
#print(powers)
values=[]
for i in range(number):
  values.append(int(powers[i]))
ordered = sorted(values)
#print(ordered)
answer=0
for i in range(number):
  answer=answer+((1/2)**(number-i))*int(ordered[i])
#print(answer)
trueanswer=answer+int(ordered[0])*(1/2)**number
print(trueanswer)

Submission status: Accepted

Solution code:
try:
    N = int(input())
    if N>1 and N<51:
        S = input()
        A = S.split()
        A = list(map(float, A))
        A.sort()
        result = A[0]
        
        if all(len(A)==N and i > 0 and i < 1001 for i in A):
                for i in range(1, N):
                    result = (result+A[i])/2

    print(result)
                                        
except:
    print("Error")

Submission status: Accepted

Solution code:
#1回合成するたびに2で割ることになるので、小さいものから貪欲に合成していく。

n = int(input())
e=[]
s=[int(i) for i in input().split()]
for i in range(n):
    e.append(s[i])
e.sort()
#print(e)
for i in range(1,n):
    e[i]=(e[i]+e[i-1])/2
print(e[n-1])

Submission status: Accepted

Solution code:
import heapq

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

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

while len(h) != 1:
    min1 = heapq.heappop(h)
    min2 = heapq.heappop(h)
    heapq.heappush(h, (min1 + min2) / 2)

print(heapq.heappop(h))

Submission status: Accepted

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

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

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

print(v_list[0])

Submission status: Accepted

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
a_list = reversed(sorted(a_list))
sum = 0
for index, a in enumerate(a_list):
  sum += pow(0.5, index+1) * a
  if index == n-1:
    sum += pow(0.5, index+1) * a

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

diviser = 2
ans = 0
for val in V[:N-1]:
    ans += val / diviser
    diviser *= 2
    
diviser //= 2
ans += V[-1] / diviser

print(ans)

Submission status: Accepted

Solution code:
from functools import reduce

n = input()
value_strings = input().split(' ')

values = list(map(int, value_strings))
values.sort()

max_value = reduce((lambda x, y: (x + y) / 2), values)
print(max_value)

Submission status: Accepted

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

v.sort()

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

ans = sum(v)

print(ans)

Submission status: Accepted

Solution code:
import heapq

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

heapq.heapify(v) 

for i in range(n-1):
    a = heapq.heappop(v)
    b = heapq.heappop(v)
    c = (a+b)/2
    heapq.heappush(v,c)
   
x = heapq.heappop(v)   
print(x)

Submission status: Accepted

Solution code:
N=int(input())
V=sorted(list(map(int,input().split())))
while len(V)!=1:
  num=(V[0]+V[1])/2
  V.pop(0)
  V.pop(0)
  V.insert(0,num)
print(V[0])

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
li = list(map(int,stdin.readline().rstrip().split()))
li.sort()
while len(li) > 1:
    a = li[0] + li[1]
    li.pop(0)
    li.pop(0)
    b = a/2
    li.insert(0,b)
print(li[0])

Submission status: Accepted

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

s.sort()
sums=0
for i in range(N):
    if i<=1:
        sums=sums+s[i]
    else:
        sums=sums+s[i]*(2**(i-1))
sums=sums/(2**(N-1))
print(sums)

Submission status: Accepted

Solution code:
import heapq  # heapqライブラリのimoprt
N = int(input())
V =list(map(int,input().split()))
heapq.heapify(V)  # リストを優先度付きキューへ、忘れない

for i in range(N-1):
 min1 = heapq.heappop(V)  # 最小値の取り出し
 min2 = heapq.heappop(V)  # 最小値の取り出し
 num = (min1+min2)/2
 heapq.heappush(V,num)  # 要素の挿入

ans = heapq.heappop(V)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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


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

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

    print(res)

    return


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(L[N-1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in raw_input().split(' ')]
A.sort()
res = (A[0] + A[1]) / 2.0
for i in xrange(2, N):
    res = (res+A[i]) / 2.0
print(res)

Submission status: Accepted

Solution code:
_,*a=map(int,open(0).read().split());a.sort();ans=a.pop(0)
for i in a:ans=(ans+i)/2
print(ans)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(w)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(100000)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

while len(v) > 1:
    new = (v[0] + v[1])/2
    del v[0:2]
    v.insert(0, new)

print(v[0])

Submission status: Accepted

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

Submission status: Accepted

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

v_ = sorted(v)

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

Submission status: Accepted

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

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

print(V[0])

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))
v = sorted(v, key=lambda x: -x)

while len(v) > 2:
  v.append((v.pop() + v.pop())/2)
print((v[0]+v[1])/2)

Submission status: Accepted

Solution code:
n=int(input())
v=[int(x) for x in input().split()]
for c in range(n-1):
    a=min(v)
    v.remove(a)
    b=min(v)
    v.remove(b)
    v.append((a+b)/2)
print(v[0])

Submission status: Accepted

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

for i in V:
    ans = (ans+i)/2

print(ans)

Submission status: Accepted

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

b.sort()
res = b[0]

for i in range(1, c):
    res = (res+b[i]) / 2

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

length = input()

values = input().split()
for i in range(len(values)):
  values[i] = int(values[i])
values.sort()

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

Submission status: Accepted

Solution code:
n = int(input())
a = (input()).split(" ")
sumv = 0
temp = []
for i in range(n):
    temp.append(int(a[i]))
temp.sort()
for i in range(n-1):
    if(i==0):
        sumv =  (temp[i] + temp[i+1])/2
    else:
        sumv = (sumv + temp[i+1])/2
print(sumv)

Submission status: Accepted

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

Submission status: Accepted

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

v.sort(reverse=True)

out=0

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

out+=v[N-1]/(2**(N-1))

print(out)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq

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

def nabe(v):
    
    if len(v) == 1:
        return v[0]

    smallests = heapq.nsmallest(2, v)

    for s in smallests:
        v.remove(s)
    v.append(sum(smallests) / 2)

    return nabe(v)

print(nabe(v))

Submission status: Accepted

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

a.sort()
for i in range(n):
  if i == 0:
    a[0] /= 2**(n-1)
  else:
    a[i] /= 2**(n-i)

print(sum(a))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# https://atcoder.jp/contests/abc138/tasks/abc138_c
N = int(input())
v = list(map(int, input().split()))
s = sorted(v)
c = s[0]
for i in range(1, N):
    c = (s[i] + c) / 2
print(c)

Submission status: Accepted

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


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

print(val)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
S = input()
X = S.split(" ")
temp = 0
ing = []

for i in X:
    ing.append(int(i))
ing.sort()


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

print(ing[0])

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=sorted(list(map(int,input().split())))
b=0
for i in range(n-1):
    b=(v.pop(1)+v.pop(0))/2
    v.append(b)
    v.sort()
print(b)

Submission status: Accepted

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

a.sort()

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

print(a[0])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
N = int(input())
v = [int(a) for a in input().split()]
 
v.sort()
 
for i in range(N-1):
    tmp = (v[0]+v[1])/2
    v.pop(0)
    v.pop(0)
    v.insert(0,tmp)
    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(1,N):
    v[i]=(v[i-1]+v[i])/2
    v[i-1]=0
    i+=1
print(v[N-1])

Submission status: Accepted

Solution code:
n=input()
n=int(n)
val=list(map(int,input().strip().split(' ')))
val.sort()
res=0
if val and n>=2:
    if len(val)==1:
        print(val[0]/2)
    elif len(val)==2:
        print((val[0]+val[1])/2)
    else:
        #res=(val[0]+val[1])/2
        res=(val[0]+val[1])/2
        for i in range(2,len(val)):
            res=(res+val[i])/2
           # print(res)
        print(res)
else:
    #print('error')
    pass

Submission status: Accepted

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

Submission status: Accepted

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

ans = a[0]

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

print(ans)

Submission status: Accepted

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

list_v.sort(reverse=True)

while len(list_v)!=2:
    x = list_v.pop()
    y = list_v.pop()
    list_v.append((x+y)/2)
    
x = list_v.pop()
y = list_v.pop()
print((x+y)/2)

Submission status: Accepted

Solution code:

N=int(input())

A=input().split()
B=[0]*N

for i in range(len(A)):
    B[i]=int(A[i])

B.sort()
B[0]=B[0]/(2**(N-1))

for i in range(len(B)-1):
    j=i+1
    B[j]=B[j]/(2**(N-j))

print(sum(B))

Submission status: Accepted

Solution code:
#AtCoder

import sys
import math
import itertools

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

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

print(V[0])


"""

"""

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#Nは食材の数を示す変数
#vは食材ごとの価値を表す
N = int(input())
v = list(map(float, input().split()))
#vを昇順に並び替える
v.sort()
#現在の価値を保管しておく変数を定義
now_value = 0.0
#価値を最大にする方法は価値の小さいものから順に入れていくのがベストと考えられる。
now_value = v.pop(0)
for i in range(N-1):
    #新たな食材を鍋の中に入れる
    now_value +=v[i]
   
    #合計値の半分(平均)を求める
    now_value = now_value /2.0

print('{:.5f}'.format(now_value))

Submission status: Accepted

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

new_value = V.pop(0)

for v in V:
    new_value = (new_value + v)/2

print(new_value)

Submission status: Accepted

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

a.sort()

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

print(a[len(a)-1])

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,  input().split()))
v = sorted(v)
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 = sorted(v)
ans = (v_sort[0] + v_sort[1]) / 2
for i in range(2, N):
    ans = (ans + v_sort[i]) / 2 
    
print(ans)

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

Solution code:
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""
N = int(sys.stdin.readline())
list_v = list(map(int, sys.stdin.readline().split()))
list_v.sort()
sum = 0

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

print(sum)

Submission status: Accepted

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

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

for n in range(2,N):
    result_value=(result_value+V[n])/2


print(result_value)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

V=sorted(v)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

tmp = values[0]

for v in values:
  tmp = (tmp+v)/2
print(tmp)

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:
import heapq
size = int(input())
li = list(map(int,input().split()))
heapq.heapify(li)
while(len(li)>1):
    a = heapq.heappop(li)
    b = heapq.heappop(li)
    heapq.heappush(li,(a+b)/2)
print(li[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def I(): return(int(sys.stdin.readline()))
def LI(): return(list(map(int,sys.stdin.readline().split())))

def main():
    N = I()
    V = sorted(LI())
    
    ans = V[0]
    for i in range(1,N):
        ans = (ans+V[i])/2
    return(ans)
    
      
    
if __name__ == "__main__":
    print(main())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
arr=list(map(int, input().split()))
while len(arr)>1:
  arr = sorted(arr)
  v1 = arr.pop(0)
  v2 = arr.pop(0)
  arr.append((v1 + v2) / 2)
print(arr[0])

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

l.sort()

ans=l[0]

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import heapq

N = int(input())
a = list(map(int,input().split()))
heapq.heapify(a)
while(True):
    if len(a)==1:
        print(a[0])
        break
    s1 = heapq.heappop(a)
    s2 = heapq.heappop(a)
    heapq.heappush(a,(s1+s2)/2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = sorted([int(x) for x in input().split()],reverse=True)
cum = (a[-1]+a[n-2])/2
for i in range(n-3,-1,-1):
  cum = (a[i]+cum)/2
print(cum)

Submission status: Accepted

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

Submission status: Accepted

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

prev = (vs[0] + vs[1]) / 2

if N > 2:
    for i in range(2, N):
        prev = (prev + vs[i]) / 2

print(prev)

Submission status: Accepted

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

prev = (vs[0] + vs[1]) / 2

if N > 2:
    for i in range(2, N):
        prev = (prev + vs[i]) / 2

print(prev)

Submission status: Accepted

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

v.sort()
ans=(v[0]+v[1])/2

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

print(ans)

Submission status: Accepted

Solution code:
N, *V = map(int, open(0).read().split())

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

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 = [int(vi) for vi in input().split()]
vv = [float(vf) for vf in v]
vv.sort()
ans = vv[0]
for i in range(1, N):
  ans = (ans + vv[i]) / 2
print(ans)

Submission status: Accepted

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

sv = sorted(v)
#print(sv)
#sv.pop(0)

#sv[0] = (sv[0]+sv.pop(1))/2
#print(sv)

for _ in range(n-1):
    sv[0] = (sv[0]+sv.pop(1))/2
    #print(sv)


print(sv[0])

Submission status: Accepted

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

v1 = list(sorted(v))
v2 = list(reversed(v1))
k = 0

for i in range(n):
  k += v2[i] * (2 ** ( -i - 1))

k += v2[n - 1] * (2 ** ( -n)) 

print(k)

Submission status: Accepted

Solution code:
n = int(input())
V = [int(v) for v in input().split()]
V.sort()
ans = sum(V[:2])/(2**(n-1))
V = V[2:]
for i, v in enumerate(V, start=1):
    ans += v / (2**(n-1-i))
print(ans)

Submission status: Accepted

Solution code:
#2019.08.18_ABC

#input
a=[]
N=int(input())
a=list(map(int, input().split()))

new_a = sorted(a)
ans=0

for i in range(len(new_a)):
    if i==0:
        ans=new_a.pop(0)
    if len(new_a)!=0:
        ans+=new_a.pop(0)
        ans=ans/2
print(ans)

Submission status: Accepted

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

v = sorted(v)

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

print(v[0])