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:
def main():
  n=int(input())
  v=list(map(int,input().split()))
  total=0
  v.sort()
#  print(v)
  v[0]=(v[0]+v[1])/2
  v[1]=1001
  for i in range(1,n-1):
    v.sort()
    v[0]=(v[0]+v[1])/2
    v[1]=1001
 #   print(v)
  
  print(v[0])
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
V = [int(i) for i in input().split()]
V.sort()
ans = (0.5 ** (n-1)) * V[0]
for i in range(1,n):
    ans = ans + (0.5 ** (n-i)) * V[i]
print(ans)

Submission status: Accepted

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

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

# solve
v.sort()
first = sum(v[0:2]) / 2
if N != 2:
    tmp = first
    for i in range(2, N):
        ans = (tmp + v[i]) / 2
        tmp = ans
else:
    ans = first

# output
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

l=sorted(l)
a=l[0]

for i in range(1,n-1):
  if i==1:
    x=(a+l[i])/2
    l[i]=x
    
  else:
    x=(l[i-1]+l[i])/2
    l[i]=x
    
ans=(l[n-2]+l[n-1])/2
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
lista=sorted(map(int,input().split()))
print(sum(lista[i]/(2**(n-i)) for i in range(n))+lista[0]/(2**n))

Submission status: Accepted

Solution code:
import fractions

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

Submission status: Accepted

Solution code:
from heapq import heappop,heappush
N = int(input())
V = list(map(int,input().split()))
V.sort()
while True:
    if len(V) == 1:
        break
    a = heappop(V)
    b = heappop(V)
    heappush(V,(a + b) / 2)
print(heappop(V))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import functools


def solve(vs):
    ws = sorted(vs)
    res = functools.reduce(lambda x, y: (x + y) / 2, ws)
    return res


def main():
    _ = int(input())
    vs = [int(v) for v in input().split()]
    res = solve(vs)
    print("{:.12f}".format(res))


if __name__ == "__main__":
    main()

Submission status: Accepted

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

sumV = 0
for i,x in enumerate(V_sort):
    p = max(0,i-1)
    sumV += x*(2**p)
    #print(p,sumV)
res = sumV/2**(N-1)
print(res)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    vs = sorted(map(int, input().split()))

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(v[-1])

Submission status: Accepted

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

a = sorted(s)

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

print(a[N-1])

Submission status: Accepted

Solution code:
result = 0
N = int(input())
array=[int(x) for x in input().split()]
array = list(array)
# print(array)

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

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

Submission status: Accepted

Solution code:
n = int(input())

arr = list(map(int, input().split(" ")))

arr.sort()

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split(' ')))
V = sorted(V)
for v in range(N-1):
    a = V.pop(0)
    b = V.pop(0)
    V.insert(0,(a+b)/2)
    #print(V)
print(V[0])

Submission status: Accepted

Solution code:
N,*v=map(int,open(0).read().split())
#print(v)
v = sorted(v)
while(len(v)>1):
  s=(v[0]+v[1])/2
  v.append(s)
  v = v[2:]
  v = sorted(v)

print(v[0])

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int,input().split()))
li.sort()
score = li[0] / (2 ** (n - 1))
del li[0]

for i in range(len(li)):
  score += li[i] / (2 ** (n - 1 - i))
print(score)

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

V = sorted(V, reverse=True)
total = 0
for i in range(len(V)):
    total += V[i] * 2 ** (-i-1)
total += V[N-1] * 2 ** (-N)
print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
v = input().split()
v_list = [int(i) for i in v]
v_list = sorted(v_list, reverse = True)
if len(v_list) > N:
  v_list = v_list[:N+1]
def calc(a, b):
  return (a+b)/2
for i in range(N):
  a = v_list.pop()
  b = v_list.pop()
  v_list.append(calc(a,b))
  if len(v_list) < 2:
    break
print(v_list[0])

Submission status: Accepted

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

for x in range(1, N):
    vlist.sort()
    new = (vlist[0] + vlist [1])/2
    del vlist[0:2]
    vlist.insert(0, new)

print(vlist[0])

Submission status: Accepted

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

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

print(value)

Submission status: Accepted

Solution code:

N = int(input())

value = list(map(int , input().split()))
value.sort()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math;

def swap(a,b):
    return (b,a)

def gcd(a,b):
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce

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


def avg(x, y):
    return (x+y)/2

print(reduce(avg, int_list))

Submission status: Accepted

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

# 低い価値のもの上位N個を合成する
V = sorted(V)
result = V[0]
for i in range(1, N):
    result = (result + V[i]) / 2

print(result)

Submission status: Accepted

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

li = sorted(li)
tmp = li[0]

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

print(tmp)

Submission status: Accepted

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

while len(V) > 1:
    list.sort(V)
    ave = (V[0] + V[1]) / 2
    V.pop(0)
    V.pop(0)
    V.append(ave)

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import logging

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    N = int(input())
    V_1 = sorted(list(map(int, input().split())))
    logging.info("Hello!")

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

    print(total)
    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
v = input().split()
for i in range(n):
	v[i] = int(v[i])
while(len(v) > 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:
import heapq
N = int(input())
V = list(map(int, input().split()))
heapq.heapify(V)


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

print(V[0])

Submission status: Accepted

Solution code:
import heapq

N = int(input())
V = list(map(int, input().split()))
q = []
for v in V:
    heapq.heappush(q, v)

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

print(q[0])

Submission status: Accepted

Solution code:
n = input()
a = input().split(" ")
a = [int(b) for b in a]
a.sort()
while True:
    a = list(a)
    if len(a) <= 2:
        break
    c = a.pop(0)
    d = a.pop(0)
    synth = (c + d) / 2
    a.append(synth)
    a.sort()
print((a[0] + a[1]) / 2)

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())

sys.setrecursionlimit(10 ** 9)


def main():
    N = INT()
    V = list(map(float, INPUT().split()))
    V.sort(reverse=True)

    for i in range(N-1):
        a = V.pop()
        b = V.pop()
        V.append((a + b)/2)

    print(V[0])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

if __name__ == "__main__":
    f_c()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(otpt)

Submission status: Accepted

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

Submission status: Accepted

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

M = [int(A[i]) for i in range(n)]
M.sort()
m = M[0]
for i in range(1,n):
  m = (m+M[i])/2
  
print(m)

Submission status: Accepted

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

ans = 0
for i, vi in enumerate(v):
    if i==0:
        ans = v[i]
    else:
        ans = (ans + v[i]) / 2
        
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split(' ')))
L = sorted(V)
NUM = L[0]
for i in range(1,N):
  NUM = (L[i] + NUM) / 2

print(NUM)

Submission status: Accepted

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

result = vs[0]
for v in vs:
  result = (result + v) / 2

print(result)

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
v = na()
v = sorted(v)
a = v[0]
for i in range(1,n):
    a = (a+v[i])/2
print(a)

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())
Vs = list(map(float, input().split()))
Vs.sort()
ans=Vs[0]
for v in Vs[1:]:
  ans = (ans+v)/2.0
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
#n = 3
#v = list(map(int, "500 300 200".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=input()
V=map(int, raw_input().split())
V.sort()

ans=None
for v in V:
	if ans is None:
		ans=v
	else:
		ans=float(ans+v)/2

print ans

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
data = [int(x) for x in stdin.readline().rstrip().split()]
data = sorted(data)
if len(data) == 1:
    print(data[0])
else:
    while len(data) > 2:
        data.append(((data[0] + data[1]) / 2))
        data = sorted(data)
        data.remove(data[0])
        data.remove(data[1])
    print(sum(data)/2)

Submission status: Accepted

Solution code:
# 差が小さければ嬉しい
# -> という考えで１WA
# 頭から愚直にやればいいかもしれない
n = int(input())
arr = sorted(list(map(int, input().split())))

while len(arr) > 1:
  x = (arr[0] + arr[1])/2.0
  arr = [x] + arr[2:]
  arr = list(sorted(arr))

print(arr[0])

Submission status: Accepted

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

def nabe(x,y):
    return (x + y) / 2

#for i in range(N - 1):
v = sorted(v)
for _ in range(N - 1):
    x = v.pop(0)
    y = v.pop(0)

    v.insert(0, nabe(x,y))

print(v[0])

Submission status: Accepted

Solution code:
N = int(input())
value = list(map(int,input().split()))
tval1 = 0
tval2 = 0


value = sorted(value)

for i in range(N-1):
  tval1 = value.pop(0)
  tval2 = value.pop(0)
  
  value.append((tval1+tval2)/2)
  value = sorted(value)

print(value[0])

Submission status: Accepted

Solution code:

from heapq import heappop,heappush
n = int(input())
A = list(map(int,input().split()))
h_queue = []
ans = 0
for i in range(n):
    heappush(h_queue,A[i])
for i in range(n-1):
    a1 = heappop(h_queue)
    a2 = heappop(h_queue)
    a3 = (a1+a2)/2
    heappush(h_queue,a3)

print(heappop(h_queue))

Submission status: Accepted

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

v = sorted(v)

def r(s):
  rp = s[2:]
  rp.extend([(s[0] + s[1])/2])
  return rp

for _ in range(n-1):
  v = sorted(r(v))
  
print(v[0])

Submission status: Accepted

Solution code:
N = int(input())

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

v.sort()

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
v = np.array(list(map(float, input().split())))
v = np.sort(v)[::-1]
while len(v) > 1:
  v[-2] = (v[-2] + v[-1])*0.5
  v = np.delete(v, -1)
print(v[0])

Submission status: Accepted

Solution code:
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

# N <= 50
N = int(stdin.readline().rstrip())
v = [int(x) for x in stdin.readline().rstrip().split()]

x = 0
y = 0

while (True):
    minn = INF
    for i in range(len(v)):
        for j in range(i+1, len(v)):
            tmp = (v[i] + v[j]) / 2
            if minn > tmp:
                x = v[i]
                y = v[j]
                minn = tmp

    v.remove(x)
    v.remove(y)
    v.append(minn)
    
    if len(v) == 1:
        print(v[0])
        exit()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(x)

Submission status: Accepted

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

import sys
import re

n = input()
v = list(map(float, input().split()))
v = sorted(v, reverse=True)

def calc(v):
    if len(v) == 2:
        return sum(v) / 2
    else:
        return calc(v[:-2] + [((v[-2] + v[-1]) / 2)])

print(calc(v))

Submission status: Accepted

Solution code:

N = int(input())

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

for i, j in enumerate(range(N)):
    if i == 0:
        result = v[i]
    else:
        result = (result + v[i]) / 2

print(result)

Submission status: Accepted

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

l_2=[2**0]
for i in range(N-1):
    l_2.append( 2**i )

s=0
for i in range(N):
    max2=l_2.pop(-1)
    maxv=v.pop(v.index(max(v)))
    s+=maxv*max2

ans=s/(2**(N-1))
print( int(ans) if ans.is_integer() else ans )

Submission status: Accepted

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

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

Submission status: Accepted

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

y=sorted(x)

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

print(z)

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    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
    return ans

if __name__ == '__main__':
    print(main())

Submission status: Accepted

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

Submission status: Accepted

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

kachi=[0]*N
kachi[0]=u[0]

for i in range(1,N):
  kachi[i]=(kachi[i-1]+u[i])/2
  
print(kachi[N-1])

Submission status: Accepted

Solution code:
import heapq
N=int(input())
v=input().split()
q=[]
for i in range(N):
    heapq.heappush(q, int(v[i]))
while len(q)>1:
    a=heapq.heappop(q)
    b=heapq.heappop(q)
    heapq.heappush(q, (a+b)/2)
print(q[0])

Submission status: Accepted

Solution code:
N=int(input())
Val=list(map(int,input().split()))
V=sorted(Val, reverse=True)
value=[]
for i in range(N-1):
    v=V[i]/(2**(i+1))
    value.append(v)
last=V[N-1]/(2**(N-1))
value.append(last)
print(sum(value))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
vlist= [int(x) for x in input().split()]
vlist.sort()
ans=vlist[0]
for v in vlist[0:]:
    ans=(ans+v)/2
print(ans)

Submission status: Accepted

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

result = []

for i, v in enumerate(Vs):
    if i == N-1:
        result.append(v*(0.5)**(i))
    else:
        result.append(v*(0.5)**(i+1))

print(sum(result))

Submission status: Accepted

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

Submission status: Accepted

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

a.sort()
ans = sum(a[:2]) / 2
for i in xrange(2, n):
    ans = (ans + a[i]) / 2

print ans

Submission status: Accepted

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

Submission status: Accepted

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


def cook(ary):
    if len(ary) == 1:
        return ary[0]

    new_v = (ary[0] + ary[1]) / 2
    new_ary = [new_v] + ary[2:]
    return cook(new_ary)

print(cook(v_list))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()] 
C = 0.0
A.sort()

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

Submission status: Accepted

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

res = 0

for i, v in enumerate(vals, 1):
    if i < N:
        res = res + v / 2 ** i
    else:
        res = res + v / 2 ** (N - 1)

print(res)

Submission status: Accepted

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

n.sort()

sum1 = n[0]

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

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

v.sort()

bans = v[0]
ans = 0
for i in range(len(v)-1):
  ans = ((bans + v[i+1])/2)
  bans = ans
  #print("ans: " + str(ans) + "bans: " + str(bans))
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
V = np.array([int(v) for v in input().split()])
Vs = np.sort(V)
v = (Vs[0] + Vs[1]) / 2.0
for i in range(2, len(Vs - 1)):
    v = (v + Vs[i]) / 2.0
print(v)

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:
a = int(input())

bb = input()
b = []
for i in bb.split(' '):
    b.append(int(i))

b.sort()
aa = b[0]
for i in range(1, len(b)):
    bb = b[i]
    aa = (aa + bb) / 2

print(aa)

Submission status: Accepted

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

w = v[0] / (2 ** (n - 1))


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

print("{:.5f}".format(w))

Submission status: Accepted

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

while len(v) > 1:
    min1 = min(v)
    v.remove(min(v))
    min2 = min(v)
    v.remove(min(v))
    avg = (min1 + min2) / 2
    v.append(avg)

print(sum(v))

Submission status: Accepted

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

v_list = sorted(v_list)

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

print(total)

Submission status: Accepted

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

ans = 0
V.sort()
# print(V)
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()

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

Submission status: Accepted

Solution code:
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
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)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = 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)]
"""

if __name__ == "__main__":
    n= int(sys.stdin.readline())
    v= list(map(int, sys.stdin.readline().split()))
    v.sort()
    if n ==2:
        print((v[1]+v[0])/2)
    else:
        tmp=v[0]
        for i in range(n-2):
            tmp = (tmp+v[i+1])/2
        ans = (tmp+v[n-1])/2
        print(ans)

Submission status: Accepted

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

v = sorted(v)

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 = int(input())
v = []
v = list(map(float, input().split()))

v.sort()

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

Submission status: Accepted

Solution code:
# coding:utf-8

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

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


print(v[0])

Submission status: Accepted

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

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = int(lines[0])
    v = [int(e) for e in lines[1].split(" ")]

    return (n, v)


def solve(n, v):

    v.sort()

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

    return total


def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Submission status: Accepted

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

v.sort()

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

Submission status: Accepted

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

print(u[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = sorted(list(map(int, input().split())), reverse=True)
ans = 0
for i, j in enumerate(v):
  if i!=len(v)-1:
    ans += j/(2**(i+1))
  else:
    ans += j/(2**(i))
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

v.sort()

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