Problem:


Score : 300 points

Problem Statement

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

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

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

Constraints

2 \leq N \leq 50

1 \leq v_i \leq 1000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
v_1 v_2 \ldots v_N

Output

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

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

Sample Input 1

2
3 4

Sample Output 1

3.5

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

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

Sample Input 2

3
500 300 200

Sample Output 2

375

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

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

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

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

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

Printing 375.0 and so on will also be accepted.

Sample Input 3

5
138 138 138 138 138

Sample Output 3

138



Sample input:
2
3 4


Sample output:
3.5

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def main():
    n = ii()
    a = li()

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

main()

Submission status: Accepted

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

total = 0
d = 2
for i in range(N - 2):
    total += v[i] / d
    d *= 2
total += (v[-2] + v[-1]) / d
print(total)

Submission status: Accepted

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

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

for i in range(N-1):
    v = sorted(v)
    v = v[2:] + [fusion(v[0], v[1])]
print(v[0])

Submission status: Accepted

Solution code:
#ACB138 C1

N=int(input())

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


def merge(mylist):
	mylist=sorted(mylist)
	curval=0
	if len(mylist)<=1:
		return mylist[0]

	curval = mylist[0]+mylist[1]
	mylist.pop(1)
	mylist.pop(0)
	mylist.append(curval/2)
	return merge(mylist)

print(merge(V))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while (len(v) > 2):
    v = sorted(v)
    v.append(sum(v[0:2]) / 2)
    v = v[2:]

print(sum(v) / 2)

Submission status: Accepted

Solution code:

N = int(input())

v = list(map(int, input().split()))  # Ni個目の具材の価値

if len(v) <= 2:
    print(sum(v) / 2)
else:
    v = list(sorted(v))

    result = 0

    while (True):

        v = sorted(v)
        l = v[0:2]

        v.append(sum(l) / 2)
        v = v[2:]

        if len(v) <= 2:
            break

    print(sum(v) / 2)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def alchemist(n,v):
    _v = sorted(v)
    tmp = _v[0]

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

    return tmp
if __name__ == '__main__':
    n = int(raw_input())
    v = map(float,raw_input().split())

    print alchemist(n,v)

Submission status: Accepted

Solution code:
from __future__ import division
n = int(raw_input())
v = map(int,raw_input().split())
v = sorted(v)
while len(v) >= 2:
	a = v.pop(0)
	b = v.pop(0)
	v.append((a+b)/2)
	v = sorted(v)
print v[0]

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(v)-1):
    av = (v.pop(1)+v.pop(0))/2
    v.insert(0,av)
print(*v)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input()) #not needed for Python, but needed for competition
A=sorted(list(map(int,input().split())))

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

Submission status: Accepted

Solution code:
def calc(N, A):
    B = sorted(A)
    result = B[0]
    for i in range(1, N):
        result += B[i]
        result /= 2
    return result


N = int(input())
A = [int(s) for s in input().split(' ')]
print(calc(N, A))

Submission status: Accepted

Solution code:
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools, os, queue
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)
def perr(s): return print(s, file=sys.stderr)


N = _I()


V = queue.PriorityQueue()
for v in LI():
    V.put(v) 
initial = True
while not V.empty():
    current = V.get()
    new = (current + V.get())/2
    if V.empty():
        V.put(new)
        break

    V.put(new)

print(V.get())

Submission status: Accepted

Solution code:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    V = string_to_int(inputs[0])
    N = len(V)
    V.sort(reverse=True)

    ret = V.pop()
    for v in reversed(V):
        ret = (ret + v) / 2
    return ret


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    input()
    ret = solve(inputs(1))
    print(ret)

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())
a = list(map(int,input().split()))
a.sort()
for i in range(1,N):
    a[i] = (a[i-1]+a[i])/2

print(a[-1])

Submission status: Accepted

Solution code:
# 大きい数値はできるだけ最後に出現させたい

n = int( input() )
vs = list( map( int, input().split() ) )
vs.sort()

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

V_sum = v[0]/2**(N-1)

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

Submission status: Accepted

Solution code:
input_a = int(input())
input_list = list(map(int, input().split()))
input_list.sort()

sum_a = input_list[0]

for i in range(input_a):
    sum_a =  sum_a/2 + input_list[i]/2

print(sum_a)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
A.sort()
x=A[0]
for a in A:
  x = (x+a)/2
print("{}".format(x))

Submission status: Accepted

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

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

print((s + v[0] + v[1]) / pow(2,cur))

Submission status: Accepted

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

Submission status: Accepted

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

v.sort()

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

print(v[0])

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int,input().split()))
def func(a,b):
    return (a+b)/2
v = sorted(v)
ave = (v[0]+v[1])/2
for i in range(2,N):
    ave = func(ave,v[i])
    
print(ave)

Submission status: Accepted

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

import math
import statistics

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)

n  = int(input())
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
  v = vs
  lastguzai = (v[0] + v[1]) / 2.00
  del v[0:2]
  v.append(lastguzai)

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

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
# sortはリストのメソッドを使う。sorted(V)は文字列、タプルで 
V.sort()
ans = V[0]
for i in range(1,N):
    # += ではなく、　=。ここでつまった。解説動画みてわかった。
    # ans += ( ans + V[i]) / 2  
    ans = ( ans + V[i]) / 2 
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

while True:
    v.sort()
    tmp = (v[0] + v[1])/2
    v.append(tmp)
    v.pop(0)
    v.pop(0)

    if len(v) == 1:
        print(v[0])
        exit()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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


ans = 0
x = lst_v[0]
for v in lst_v[1::]:
    y = v
    ans = (x + y) / 2
    x = ans
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())
mylist = [int(s) for s in input().split()]
mylist.sort()
#myans = 0

#for i in range(N):
#    myans += 1/int(mylist[i])
#print(mylist)

myans = (mylist[0]+mylist[1])/2 

for i in range(2, len(mylist)):
    myans = (myans + mylist[i])/2

print(myans)

Submission status: Accepted

Solution code:
#abc138c

n=int(raw_input())
v=map(int,raw_input().split())
v.sort()
res=v[0]
for i in xrange(1,n):
 res=1.0*(res+v[i])/2
print res

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())))
ans = 0.5 * sum(v[:2])
if n > 2:
    for i in range(2,n):
        ans = 0.5 * (ans + v[i])
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

v.sort(reverse=True)

while len(v) >= 2:
    last = v.pop()
    second_last = v.pop()
    new_val = (last + second_last) / 2
    v.append(new_val)

print(v[0])

Submission status: Accepted

Solution code:
n = int(input())

v = input().split()

for i in range(n):
    v[i] = int(v[i])

v.sort()

avg = v[0]

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

print("{}".format(avg))

Submission status: Accepted

Solution code:
n,*v=map(int,open(0).read().split());v.sort();print(v[0]/2**n+sum(v[i]/2**(n-i)for i in range(n)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1, n-1):
  ans += v.pop(-1)/(2**(i))
  
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

foods = [int(i) for i in input().split()]

foods.sort()

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

print(foods[0])

Submission status: Accepted

Solution code:
from collections import deque
n = int(input())
v = [int(i) for i in input().split()]
v.sort()
vi = deque(v)
while len(vi) != 1:
	v0 = vi.popleft()
	v1 = vi.popleft()
	vadd = (v0+v1)/2
	vi.appendleft(vadd)
print(vi[0])

Submission status: Accepted

Solution code:
x=int(input())
l=[]
for x in map(int,input().split()):
    l.append(x)
l.sort()
e=(l[0]+l[1])/2
z=2
while(z<len(l)):
    e=(l[z]+e)/2
    z+=1
print(e)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,input().split()))
l.sort()
while len(l)>1:
  x = l.pop(0)
  y = l.pop(0)
  l.append((x+y)/2)
  l.sort()
ans = l.pop()
if ans-int(ans)>0:
  print(ans)
else:
  print(int(ans))

Submission status: Accepted

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

values = sorted(V)

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

print(ans)

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from decimal import Decimal
from itertools import permutations

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

# スペース区切りの整数の入力
V = list(map(Decimal, input().split()))

result = 0

V = sorted(V)
result = V[0]

for value in V[1:]:
    result = (result + value) / 2


# 出力
print(result)

Submission status: Accepted

Solution code:
import heapq
lens = int(input())
vals = [int(x) for x in input().split()]
heapq.heapify(vals)

while len(vals) > 1:
    curr = heapq.heappop(vals)
    curr += heapq.heappop(vals)
    curr /= 2
    heapq.heappush(vals, curr)
    #print(vals)
print(vals[0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import random
num = int(input())
s =list(map(int,input().split()))
s =sorted(s)
a = s[0]

for i in range(num):
  a=(a+s[i])/2
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

ans = Lists[0]

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

print(ans)

Submission status: Accepted

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

v.sort()

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    arr = list(map(int,input().split()))
    arr.sort()
    ans = 0
    x = arr[0]
    y = arr[1]
    for i in range(2,len(arr)):
        z = (x+y)/2
        y = arr[i]
        x = z
        #print(z,x,y)

    print((x+y)/2)


main()

Submission status: Accepted

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

for i, x in enumerate(v):
    if i == N - 1:
        i = N - 2
    result += x / pow(2, i + 1)

print(result)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
sv = sorted(v)
mm = sv[-1]
p, ans = 0, 0
if n == 2:
    print(sum(sv)/n)
    exit()
else:
    ans = (sv[0]+sv[1])/2
    p = ans
for x in sv[2:-1]:
    ans = (ans+x)/2
print((ans+mm)/2)

Submission status: Accepted

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

for i, x in enumerate(v):
    if i == N - 1:
        i = N - 2
    result += x / pow(2, i + 1)

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

v.sort()
t = []

for i in range(N):
    if i == 0:
        t.append(v[i])
    else:
        t.append(v[i] * 2**(i-1))

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

Submission status: Accepted

Solution code:
input()
A=sorted(list(map(int,input().strip().split(' '))))
temp=A[0]
for i in range(1,len(A)):
    temp=(temp+A[i])/2
print(temp)

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())
lista=list(map(int,input().split()))
lista.sort()

for i in range(n-1):
    lista.append((lista[0]+lista[1])/2)
    lista.pop(0)
    lista.pop(0)
    lista.sort()
    
print(lista[0])

Submission status: Accepted

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

Submission status: Accepted

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

def mix( a, b ):
  return ( a + b ) / 2.0

v = mix( gu[0], gu[1])
for i in range( 2, len( gu )):
  v = mix( gu[i], v )

print(v)

Submission status: Accepted

Solution code:
import sys, math, itertools, bisect, copy, re

from collections import Counter, deque, defaultdict
from itertools import accumulate, permutations, combinations, takewhile, compress, cycle
from functools import reduce
from math import ceil, floor, log10, log2, factorial
from pprint import pprint

# 10倍速いらしい
input = sys.stdin.readline

INF = float('inf')
MOD = 10 ** 9 + 7
EPS = 10 ** -7
sys.setrecursionlimit(1000000)

N = int(input())
V = [int(x) for x 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())
aryNum = list(map(int, input().split()))

while (len(aryNum) > 1):
    """ 公式ドキュメントと提出サンプルを参考に
    aryNum.sort()
    a = aryNum[0]
    b = aryNum[1]
    aryNum.remove(a)
    aryNum.remove(b)
    """
    aryNum.sort(reverse=True)
    a = aryNum.pop()
    b = aryNum.pop()

    aryNum.append((a + b) / 2)

print(aryNum[0])

Submission status: Accepted

Solution code:
n = int(input())
a = sorted([int(i) for i in input().split()])
c = a[0]
for i in a[1:]:
  c = (c + i) / 2
print(c)

Submission status: Accepted

Solution code:
N = int(input())
v = [int(x) for x in input().split()]
v.sort()
ans = 0
for ind,i in enumerate(v[1:]):
    if(ind==0):
        ans = (v[0]+v[1])/2
    else:
        ans = (ans+i)/2
print(ans)

Submission status: Accepted

Solution code:
import math
N = int(input())
v = list(map(int,input().split()))
v_new = 0
#新しい具材の価値をv_newとした
a = 0
k = []
#kで
p = N
for i in range(N-1):
    #全ての要素が同じ場合は終了する
    if v.count(v[0]) == p:
        break
    else:
       x = min(v)
       v.remove(x)
       #xをvのリストから除外
       y = min(v)
       v_new = (x+y)/2
       #価値を(x+y)/2とした
       v.append(v_new)
       #v_newをvのリストに挿入
       v.remove(y)
       #yをvのリストから除外
       v_new = 0
       #v_newを初期化
       p = p-1
       a = 0
       x = 0
       y = 0
print(v[0])

Submission status: Accepted

Solution code:
N=int(input())
v = list(map(float,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=list(map(int,input().split()))
count=N
v.sort()
while count>1:
    v[0] = (v[0]+v[1])/2
    del v[1]
    count-=1
print(v[0])

Submission status: Accepted

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

for _ in range(n-1):
  l[0] = (l[0] + l[1]) / 2
  del l[1]
  l = sorted(l)

print(l[0])

Submission status: Accepted

Solution code:
_ = input()
v = sorted(list(map(int, input().strip().split(' '))))
now = v[0]
for i in range(1, len(v)):
  now = (now + v[i])/2
print(now)

Submission status: Accepted

Solution code:
N = int(input())
v = list(map(int, input().split()))
import heapq
def heapsort(iterable):
    h = []
    for value in iterable:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]
heap = heapsort(v)
result = heap[0]
for k in range(1, N):
  result = (result+heap[k])/2
print(result)

Submission status: Accepted

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

Submission status: Accepted

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

arr.sort()

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

Submission status: Accepted

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

for i in range(2, n):
    lv[i] = lv[i] * (2 ** (i-1))

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
s = np.array(sorted(list(map(int, input().split()))))
a = 2 ** np.arange(1,n)[::-1]
a = np.append(a[0], a)


print(sum(s/a))

Submission status: Accepted

Solution code:
_,v=open(0)
s,*v=sorted(map(int,v.split()))
for i in v:s=(s+i)/2
print(s)

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

Submission status: Accepted

Solution code:
#coding: utf-8

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

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

print (V[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline


def main():
    n = int(input())
    v = list()

    for i in map(int, input().split()):
        v.append(i)

    v.sort()

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

print(round(ans,6))

Submission status: Accepted

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

arr.sort()

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

print(temp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
Mod = 1000000007




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

if __name__ == "__main__":
    main() #endline===============================================





def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n < 2 is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))):
        if prime[i] == 1:
            for j in range(2*i,n):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n):
        if prime[i] == 1:
            res.append(i)
    return res

class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py

    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

Submission status: Accepted

Solution code:
N, V = int(input()), 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())
List=list(map(int,input().split()))
List.sort()
a= List[0]
for i in range(len(List)):
  a= (a+List[i])/2
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from bisect import insort

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

v.sort()
while len(v) > 1:
    x = v.pop(0)
    y = v.pop(0)
    insort(v, (x + y) / 2)

print(v[0])

Submission status: Accepted

Solution code:
num = int(input())
lists = sorted(map(int, input().split()))[::-1]

tmp = 0.0

for _ in range(num - 1):
    x = lists.pop()
    y = lists.pop()
    lists.append((x + y) / 2)

print(lists[0])