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:
# https://atcoder.jp/contests/abc138/tasks/abc138_c

input_list = [input() for i in range(2)]

maxNum = int(input_list[0])

nums = [int(i) for i in input_list[1].split(' ')]

nums.sort()

value = 0
is_first_item = True
index = maxNum - 1
for num in nums:
    if is_first_item:
        value = value + num / (2 ** index)
        is_first_item = False
    else:
        value = value + num / (2 ** index)
        index = index - 1

print(value)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from bisect import insort_left

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


v = sorted(v)

ans = 0

while len(v) > 1:
    v0 = v.pop(0)
    v1 = v.pop(0)

    insort_left(v, (v0+v1)/2)

print(v[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import functools

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

print(functools.reduce(lambda x, y: (x + y) / 2, V[1:], V[0]))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

v = sorted(v)
V = (v[0] + v[1])/2

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

Submission status: Accepted

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

while len(vl) != 1:
    vl.sort()
    v0 = vl.pop(0)
    v1 = vl.pop(0)
    vl.append((v0 + v1) / 2)

print(vl[0])

Submission status: Accepted

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

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

Submission status: Accepted

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

V.sort()
A=0

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

  if i >=1:
    A = (A+V[i+1])/2
    
print(A)

Submission status: Accepted

Solution code:
N = int(input())
value_list = input().split()
new_value_list = []
for v in value_list:
	v = float(v)
	new_value_list.append(v)
new_value_list.sort()
#value_list.reverse()
#print(new_value_list)
for i in range(N):
	if i == 0:
		new_value = new_value_list[i]
	else:
		new_value = (new_value + new_value_list[i]) / 2
	
	#print(new_value)

print(new_value)

Submission status: Accepted

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

avg = (v[0] + v[1]) / 2
i = 2

while True:
    if i == len(v):
        break
    else:
        avg = (avg + v[i]) / 2
    i += 1

print(avg)

Submission status: Accepted

Solution code:
I0 = lambda :map(int,input().split())
I1 = lambda :int(input())
I2 = lambda :list(map(int,input().split()))
#####################################################
v = I1()
a = sorted(I2())
res=a[0]
for i in range(1,v):
    res = (a[i]+res) / 2
print(res)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

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

Submission status: Accepted

Solution code:
n = int(input())
list1 = [int(i) for i in input().split()]
list1.sort()
while len(list1)>1:
    list1[0]=(list1[0]+list1[1])/2
    list1.pop(1)
print(list1[0])

Submission status: Accepted

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

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

ans = v[0]
for i in range(n-1):
    ans = ave(ans,v[i+1])
print(ans)

Submission status: Accepted

Solution code:
import itertools

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

v.sort(reverse=True)

shadow = v[:]

for i in range(N-1):

  a = shadow.pop()
  b = shadow.pop()

  shadow.append((a+b)/2)
ret = max(ret,shadow[0])

print(ret)

Submission status: Accepted

Solution code:
N = int(input())

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

#小さいものから計算していく
v.sort()

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

print(v[N-1])

Submission status: Accepted

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

list_a.sort()

for m in range(n - 1):
    new = 0
    new += (list_a[0] + list_a[1]) / 2
    del list_a[0:2]
    list_a.append(new)
    list_a.sort()

print(list_a[0])

Submission status: Accepted

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

v.sort(reverse=True)

ans = sum([x / 2 ** (i+1) for i, x in enumerate(v[:-1])]) + v[-1] / 2 ** (N - 1)

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

print(v[n-1])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# https://atcoder.jp/contests/abc138/tasks/abc138_c

# サンプルから考えるに sort して最初から合成していくのがよいのでは
input()  # Skip
nums = list(map(int, input().split()))  # Numbers

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

nums = sorted(nums)
avg = nums[0]
for i in range(len(nums) - 1):
    avg = (avg + nums[i + 1]) / 2

print(avg)
exit()

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())

str_list = input().split(' ')
A = [int(x) for x in str_list]
A = np.array(A)

while len(A)>1:
    first_min = A[A.argmin()]
    #print(first_min)
    A = np.delete(A, A.argmin())
    second_min = A[A.argmin()]
    #print(second_min)
    A = np.delete(A, A.argmin())
    mean = (first_min+second_min)/2.0
    A = np.append(A, mean)
    #print(A)
print(mean)

Submission status: Accepted

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

Submission status: Accepted

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

v.sort()

tmp = v[0]
# processing
for i in v:
    tmp = (tmp + i) / 2

# output
print(tmp)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import exit, stderr, stdin
input = stdin.readline
# setrecursionlimit(10**7)

def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


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

    res = 0
    for _ in range(N-1):
        a = sorted(a, key=lambda x: -x)
        res = (a[-1]+a[-2])/2
        a.pop()
        a.pop()
        a.append(res)
    print(a[0])
if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 = input()
v = map(int, input().split())
v2 = sorted(v)
s = v2[0]
for i in v2[1:]:
    s = (s + i) / 2

print(s)

Submission status: Accepted

Solution code:
def m():
    N = int(input())
    V = [int(i) for i in input().split()]
    V.sort()
    while len(V) > 1:
        V[0] = (V[0] + V[1]) / 2
        V.pop(1)
    print(V[0])

m()

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

Submission status: Accepted

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

Submission status: Accepted

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

s = len(v)

v = [t/2**(s-i) for i, t in enumerate(v)]
v[0] *= 2

print(sum(v))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
b = []
for i in range(len(a)-1):
    b.append(i+1)
b.append(b[-1])
b.reverse()
for i in range(len(a)):
    ans += a[i] * (1/2 ** b[i]) 
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:
t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in range(1,t):
  
  s+=l[i]
  s/=2
print(s)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
#-------------------------------------
n = int(input())
v = list(map(int,input().split()))
v.sort()

ans = -1
for i in v:
    if ans == -1:
        ans = i
    else:
        ans = ( ans + i ) / 2

print(ans)

Submission status: Accepted

Solution code:
from heapq import heapify
from heapq import heappop
from heapq import heappush
n=int(input())
v=list(map(int,input().split()))
heapify(v)
ans=0
while len(v)>1:
  s=(heappop(v)+heappop(v))/2
  heappush(v,s)
print(heappop(v))

Submission status: Accepted

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

v_L.sort()

result = v_L[0]
for val in range(1,n):
    result = (result + v_L[val])/2

print(result)

Submission status: Accepted

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

v_L.sort()

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

result = v_L[0]
for val in range(1,n):
    result = (result + v_L[val])/2

print(result)

Submission status: Accepted

Solution code:

# Solution: sort and then combine result of mixing first and second with the third, etc. so that most valuable are weighted heighest

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

ingredients.sort()
value = ingredients[0]
for ingredient in ingredients:
    value = (value+ingredient) / 2
print(value)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ls.sort()
ans=ls[0]
ls.pop(0)
for l in ls:
  ans=(ans+l)/2
print(ans)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    N = int(input())
    s = list(map(int, input().split()))
    s.sort()

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

    print(tmp)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
s = list(map(int,input().split()))
c = 0

s = sorted(s)

for i in range(n-1):
    if c == 0:
        c = (s[i] + s[i+1]) / 2 
    else:
        c = (c + s[i+1]) / 2 

print(c)

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(ans)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
v = list(map(int,input().split()))
v.sort()
x = np.zeros(N,dtype = "float64")
for i in range (0,N):
  x[i] = v[i]

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

Submission status: Accepted

Solution code:
import numpy as np

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

ans = v[0]

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

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())
v_lst = [int(v) for v in stdin.readline().rstrip().split()]
v_lst.sort()

while(len(v_lst) > 1):
  v0 = v_lst.pop(0)
  v1 = v_lst.pop(0)
  vn = (v0 + v1) / 2
  v_lst.append(vn)
  v_lst.sort()
  
print(v_lst[0])

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq
 
n = int(raw_input())
values = map(int, raw_input().split())
values = sorted(values, reverse=True)
 
print sum(((0.5)**(i+1))*v for i, v in enumerate(values)) + ((0.5)**(len(values)))*values[-1]

Submission status: Accepted

Solution code:
num = int(input())

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

count = 0
for i in range(1,num):
    value[i] = (value[i-1]+value[i])/2

print(value[-1])

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.0
print(ans)

Submission status: Accepted

Solution code:
import numpy as np
N = input()
N = int(N)
V = input().split()
V = [int(V[i]) for i in range(N)]

V = np.array(V)

while len(V) >= 2:
  V = np.sort(V)
  new = (V[0] + V[1]) / 2
  V = np.hstack([V[2:], new])

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

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

arr.sort()
res = (arr[0]+arr[1])/2
i = 2
while (i < n):
    res = (res+arr[i])/2
    i=i+1
print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

def Alch(arr):
  arr.sort()
  n1 = arr[0]
  n2 = arr[1]
  new_val = (n1 + n2) / 2
  arr[1] = new_val
  return arr[1:]

for i in range(n-1):
  arr = Alch(arr)

print(arr[0])

Submission status: Accepted

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

li.sort()
result=li[0]
for i in li:
  result+=i
  result/=2
print(result)

Submission status: Accepted

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

V.sort()
ans = V[0]
for n in range(1,N):
    ans = (ans+V[n])/2

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sam)

Submission status: Accepted

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

v_arr.sort()
tmp = v_arr[0]
for i in range(1,N):
    tmp = (tmp+v_arr[i])*0.5

print(tmp)

Submission status: Accepted

Solution code:
if __name__ == "__main__":

    n = int(input())
    a_list = map(int, input().split())
    a_list_sorted = sorted(a_list)
    
    sum = (a_list_sorted[0] + a_list_sorted[1])/2 
    for i, a in enumerate(a_list_sorted):
        if i >= 2:
            sum = (sum + a)/2

    print('{0}'.format(sum))

Submission status: Accepted

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

v.sort()

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

n=N
s=V[0]/(2**n)
for i in V :
  I=i/(2**n)
  s+=I
  n-=1
  
print(s)

Submission status: Accepted

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

v.sort()

son = v[0]

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

print(son)

Submission status: Accepted

Solution code:
def main(v=[]):
    v.sort()

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

    print(pre)


if __name__ == "__main__":
    n = int(input())
    v = list(map(int, input().split()))

    main(v)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

list.sort()
avg = 0
for num in list:
    if avg == 0:
        avg = num
    else:
        avg = (num + avg) / 2
print(avg)

Submission status: Accepted

Solution code:
N = int(input())
vs = sorted(map(int, input().split(" ")), reverse=True)
 
r = [v * (0.5 ** (i + 1)) for i, v in enumerate(vs)]
r [-1] = r[-1] * 2
print(sum(r))

Submission status: Accepted

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

print(s)

Submission status: Accepted

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

if(n>1):
    
    list1.sort()
    #print('ソート後(昇順)：{}'.format(list1))

    #list1.reverse()
    #print('ソート後(降順)：{}'.format(list1))

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

    print(tmp)

else:
    print(list1[0])

Submission status: Accepted

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

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())
l = [int(i) for i in input().split()]
l.sort()
while len(l) > 1:
  l[1] = (l[0]+l[1])/2
  l.remove(l[0])
print(l[0])

Submission status: Accepted

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

Submission status: Accepted

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

v = sorted(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()))

for i in range(N-1):
  k = min(V)
  V.remove(min(V))
  l = min(V)
  V.remove(min(V))
  V.append((k + l) / 2)
  
print(V[0])

Submission status: Accepted

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

v.sort()

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

print(v[0])

Submission status: Accepted

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

Submission status: Accepted

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

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

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
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

vs.sort()

if N == 2:
    print((vs[0] + vs[1]) / 2)
    exit()

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

print(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
arr = list(map(lambda n: int(n), input().split()))
sorted_arr = sorted(arr)
s = 0

for n in range(N):
    if n == 0:
        continue
    elif n == 1:
        s = (sorted_arr[0] + sorted_arr[1])/2
    else:
        s = (s + sorted_arr[n])/2

print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
v=[int(i) for i in 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()))
v.sort()
ans=0
for i in range(n):
  if i == 0:
    ans = v[i]
  else:
    ans=(ans + v[i])/2



print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list()
for elem in input().split(' '):
    a.append(int(elem))
    
a.sort()
sum = 0
for member in a:
    if sum ==0:
        sum = member
    else:
        sum = (sum + member)/2
print(sum)

Submission status: Accepted

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

V = sorted(V)

ans = 0

for v in V:
    if ans == 0:
        ans = v
    else:
        ans = (ans + v) / 2
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v_list = [int(v) for v in input().split(" ")]
v_list.sort(reverse=True)
sum = 0
for i in range(len(v_list)):
    if i+1 < len(v_list):
        sum += v_list[i]/(2**(i+1))
    else:
        sum += v_list[i]/(2**i)
print(sum)

Submission status: Accepted

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

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

print(Vlist[0])

Submission status: Accepted

Solution code:
n1 = int(input())
n2 = list(map(int, input().split()))
n3 = sorted(n2)
n3.reverse()
n4 = [n3[i]*(1/2**(i+1)) for i in range(len(n3))]
n5 = n3[(len(n3) - 1)]*(1/2**(len(n3)))
print(sum(n4) + n5)

Submission status: Accepted

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

vl.sort()
ans=(vl[0]+vl[1])/2.0

for i in range(2,n) :
  ans=(ans+vl[i])/2.0
print('{:.7f}'.format(ans)) #小数点以下3位

Submission status: Accepted

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


def minIdx(li):
    min = 0
    for num in li:
        min = li.index(num) if num < li[min] else min
    return min


while len(V) != 1:
    x = (V.pop(minIdx(V)) + V.pop(minIdx(V))) / 2
    V.append(x)

print(V[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce

n = int(input())
v = [int(_) for _ in input().split()]

v.sort()
answer = reduce(lambda x, y: (x + y) / 2, v)
print(answer)

Submission status: Accepted

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

A.sort()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import bisect as b
n = int(input())
v = sorted([int(i) for i in input().split()])

for j in range(n-1):
  b.insort(v,(v[0]+v[1])/2)
  del v[0]
  del v[1]
  
print(v[0])

Submission status: Accepted

Solution code:
def _input():
    number = input()
    array = input().split()
    number_array = []
    for i in array:
        number_array.append(int(i))
    return number_array

def composition(number_array):
    number_array.sort()
    total_value = 0
    counter_flag = 0
    for i in number_array:
        if counter_flag >= 1:
            total_value = (total_value + i) / 2
        else:
            total_value = i
        counter_flag += 1

    return total_value

if __name__ == "__main__":
    array = _input()
    print(composition(array))

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
V = input().split()
V = np.array(V).astype(int)
V = np.sort(V)

U = np.array([])

for _ in range(2):
    U = np.append(U, 0.5**(N-1))
    
for i in range(2, N):
    U = np.append(U, 0.5**(N-i))

print(np.dot(U, V))

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

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

V.sort()

value = V[0]
for n in range(1, N):
    value = (value + V[n]) / 2.0

print(value)

Submission status: Accepted

Solution code:
from functools import reduce

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

v.sort()

max_val = reduce(lambda x, y: (x+y)/2, v)

print(max_val)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    v = sorted(list(map(float, input().split())), reverse=True)
    while (len(v) > 1):
        pops = v[-2:]
        del v[-2:]
        ave = sum(pops) / 2
        v.append(ave)
    print(v.pop())

Submission status: Accepted

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

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


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

Submission status: Accepted

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

Submission status: Accepted

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