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:
class HeapQueue:
    """
    q = HeapQueue()
    q.append(p, v)
    v = q.pop()
    """
    from heapq import heappop, heappush, heappushpop, heapreplace

    def __init__(self, reverse=False):
        self.reverse = reverse
        self.heap = []

    def __len__(self):
        return len(self.heap)

    def append(self, p, v):
        self.heappush(self.heap, (-p if self.reverse else p, v))

    def appendpop(self, p, v):
        return self.heappushpop(self.heap, (-p if self.reverse else p, v))

    def popappend(self, p, v):
        return self.heapreplace(self.heap, (-p if self.reverse else p, v))

    def pop(self):
        return self.heappop(self.heap)[1]

    def front(self):
        return self.heap[0][1]


N = int(input())
v = [int(s) for s in input().split()]
q = HeapQueue()
for vi in v:
    q.append(vi, vi)
while len(q) > 1:
    a = q.pop()
    b = q.pop()
    v = (a + b) / 2
    q.append(v, v)
print(q.pop())

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline

##### リストの 二分木検索 #####
# bisect_left(lists, 3)
# bisect_right(lists, 3)

##### プライオリティキュー #####
# heapq.heapify(a) #リストaのheap化
# heapq.heappush(a,x) #heap化されたリストaに要素xを追加
# heapq.heappop(a) #heap化されたリストaから最小値を削除＆その最小値を出力

# heapq.heappush(a, -x) #最大値を取り出す時は、pushする時にマイナスにして入れよう
# heapq.heappop(a) * (-1) #取り出す時は、-1を掛けて取り出すこと

##### タプルリストのソート #####
# sorted(ans) #(a, b) -> 1st : aの昇順, 2nd : bの昇順
# sorted(SP, key=lambda x:(x[0],-x[1])) #(a, b) -> 1st : aの昇順, 2nd : bの降順
# sorted(SP, key=lambda x:(-x[0],x[1])) #(a, b) -> 1st : aの降順, 2nd : bの昇順
# sorted(SP, key=lambda x:(-x[0],-x[1])) #(a, b) -> 1st : aの降順, 2nd : bの降順

# sorted(SP, key=lambda x:(x[1])) #(a, b) -> 1st : bの昇順
# sorted(SP, key=lambda x:(-x[1])) #(a, b) -> 1st : bの降順

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N = inputInt()
	A = inputList()

	A.sort()
	ans = 0
	for i,val in enumerate(A):
		if i == 0:
			ans = val
			continue

		ans = (ans + val) / 2

	print(ans)


if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    N = int(input())
    # N, K = map(int, input().split())
    v = sorted(list(map(int, input().split())), reverse=True)
    # s = input().strip()
    ans = 0
    tmp = 2
    for i in range(N-1):
        ans += v[i]/tmp
        if i == N-2:
            ans += v[i+1]/tmp
        tmp *= 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 range(1, n):
    ans = (ans + v[i]) / 2
print(ans)

Submission status: Accepted

Solution code:
# ABC138
def main():
    N = int(input())
    V = sorted(map(int, input().split()))
    ans = (V[0] + V[1]) / 2
    for i in V[2:]:
        ans = (ans + i) / 2
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# A, B = [int(i) for i in input().split(" ")]
# A = int(input())
# As = [int(i) for i in input().split(" ")]
# Ss = ["".join(sorted(input())) for _ in range(N)]
# from math import factorial
# def nCr(n, r): return factorial(n) // factorial(r) // factorial(n - r)

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

Submission status: Accepted

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

m.sort()

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

Submission status: Accepted

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

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def main():
    n = ri()
    lv = rli()
    lv.sort()
    ans = lv[0]
    for i in range(1, n):
        ans = (lv[i]+ans)/2
    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

vs = list(reversed(sorted(vs)))

while len(vs) >= 2:
    v1 = vs.pop()
    v2 = vs.pop()
    v = (v1 + v2) / 2.0
    vs.append(v)
print(vs[0])

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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
v = LIST()

v.sort()
ans = (v[0]+v[1])/2
for i in range(N):
	if i==0 or i==1:
		continue
	else:
		ans = (ans + v[i])/2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = A[0]
for a in A[1:]:
  ans = (ans + a) / 2
print(ans)

Submission status: Accepted

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

def readInts():
  return [int(s) for s in input().split(" ")]

def main():
  N = readInts()[0]
  V = readInts()
  V.sort()

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

if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
from collections import deque

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

L = sorted(L)
q = deque(L)

while len(q) > 1 :
    a = q.popleft()
    b = q.popleft()
    x = a+b
    x /= 2
    q.appendleft(x)
print(q.popleft())

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
v.sort()
c = 0
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())
lst = list(map(int,input().split()))

lst.sort()
for i in range(n):
    if i==0:
        ans = lst[i]
    else:
        ans = (ans + lst[i]) / 2
print(ans)

Submission status: Accepted

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

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

print(v[0])

Submission status: Accepted

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

Submission status: Accepted

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

r = vl[0]
for i in range(1,n):
    y = vl[i]
    r = (r+y)/2
print(r)

Submission status: Accepted

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

N = int(input())
v = list(map(int, input().split()))
v.sort(reverse=True)
while len(v) != 1:
    a = v.pop()
    b = v.pop()
    v.append((a+b)/2)
    v.sort(reverse=True)
print(v[0])

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

Solution code:
import heapq
N = int(input())
V = list(map(int, input().split()))
heapq.heapify(V)
for i in range(N-1):
    a, b = heapq.heappop(V), heapq.heappop(V)
    heapq.heappush(V, (a + b) / 2)
print(heapq.heappop(V))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

print(current_num)

Submission status: Accepted

Solution code:
import heapq

def sol():
    N = int(input())
    A = list(map(int, input().split()))

    hq = []
    for a in A:
        heapq.heappush(hq, a)

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

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


sol()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
Vn = sorted(map(int,input().split()))
ans = 0
advancenum = Vn[0]
for v in range(1,len(Vn)):
    num=(advancenum+Vn[v])/2
    advancenum = num
    ans=num
print(ans)

Submission status: Accepted

Solution code:
class Solution:
    def main(self):
        N = int(input())
        v = list(map(int, input().split()))
        v = sorted(v)
        res = v[0]
        for i in range(1, N):
            res = (res + v[i]) / 2

        print(res)


if __name__ == '__main__':
    Solution().main()

Submission status: Accepted

Solution code:
n = int(input())

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

v.sort()

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right
from heapq import heappush, heappop

import re
# import numpy as np
from scipy.misc import comb

# 再帰がやばいとき
# import sys
# sys.setrecursionlimit(10**9)

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e30)
MOD = int(1e9)+7 # 10^9 + 7

# field[H][W]
def create_grid(H, W, value = 0):
    return [[ value for _ in range(W)] for _ in range(H)]

########

def main():
    N = i_inpl()
    v = l_inpl()
    v.sort()
    tmp = (v[0] + v[1])/2
    for vi in v[2:]:
        tmp = (tmp + vi)/2
    print(tmp)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

N=int(input())

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



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

print(V[N-1])

Submission status: Accepted

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

val = a[0]
for item in a[1:]:
    val = (val + item) / 2.0
print(val)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
import fractions
import copy
import numpy as np
import heapq
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
"""
#decomment when needed
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
"""
n = ip()
a = iprow()
a.sort()
s = 0
for i in range(n-1):
    s = a[i]+a[i+1]
    s/=2
    a[i+1]  = s
print(a[n-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+=v[i]
    ans/=2
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(float, 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
heappop=heapq.heappop
heappush=heapq.heappush
n=int(input())
V=list(map(int,input().split()))
V.sort()
for _ in range(n-1):
    a=heappop(V)
    b=heappop(V)
    heappush(V,(a+b)/2)
print(V[0])

Submission status: Accepted

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

for _ in range(n-1):
  v.sort()
  v[:2]=[sum(v[:2])/2]
print(v[0])

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    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

    return ans


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

Submission status: Accepted

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

Submission status: Accepted

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

value = V.__iter__().__next__()

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

print(value)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections, copy, heapq


def solve(N: int, v: "List[int]"):
    v.sort()
    c = (v[0] + v[1]) / 2
    for vv in v[2:]:
        c = (c+vv)/2
    print(c)
    return


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

sum = 0
index=0
while index < len(listV):
    if index == 0:
        sum = (listV[index]+listV[index+1])/2
        index+=2
    else:
        sum = (sum+listV[index])/2
        index+=1
print(sum)

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())
a = sorted(list(map(int, input().split())))
ans = a.pop(0)
for i in a: ans = (ans+i)/2
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
import fractions
from functools import reduce
def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = onem()

a = l()

a.sort()

k = a[0]

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

print(k)

Submission status: Accepted

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

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

Submission status: Accepted

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

t = v[0]
for a in v[1:]:
    t = (t + a) / 2

print(t)

Submission status: Accepted

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

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

print(t)

Submission status: Accepted

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

Submission status: Accepted

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

alist=sorted(alist, reverse=True)
kati=0
for i in range(n-1):
    kati+=(alist[i]/(2**(i+1)))

kati+=(alist[n-1]/(2**(n-1)))

print(kati)

Submission status: Accepted

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

V.sort()

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

print(ans)

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n = int(input())
vvv = list(sorted(get_nums_l()))

ans = reduce(lambda a,b:(a+b)/2, vvv)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import heapq

n = int(input())
lst = list(map(int, input().split()))
heapq.heapify(lst)

while len(lst) > 1:
    a = heapq.heappop(lst)
    b = heapq.heappop(lst)
    heapq.heappush(lst, (a + b) / 2)
print(lst[0])

Submission status: Accepted

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

nums.sort()

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

Submission status: Accepted

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

vs_sorted = sorted(vs)

pre_v = 0.0
for i, v in enumerate(vs_sorted):
    if i == 0:
        pre_v = v
        continue
    pre_v = (pre_v + v) / 2

print(pre_v)

Submission status: Accepted

Solution code:
N=int(input())
*V, = map(int,input().split())
V.sort(reverse=True)
while V[1:]:
    v = V.pop()
    V[-1] = (V[-1]+v)/2
print(V[0])

Submission status: Accepted

Solution code:
n = int(input())
v = [ int(i) for i in 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:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())


n = ni()
v = list(li())
v.sort()
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())
A = [int(i) for i in input().split()]

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

B = sorted(A)
answer =  (B[0] + B[1])/2
for i in range(len(B)-2):
    j = i+2
    answer = (answer + B[j])/2
print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=sorted(list(map(int,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:
#import sys
#input = sys.stdin.readline
def main():
    N = int( input())
    V = list( map( int, input().split()))
    V.sort()
    now = V[0]
    for i in range(1,N):
        now = (now+V[i])/2
    print(now)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import heapq
N = int(input())
v = list(map(int,input().split()))
heapq.heapify(v)
while len(v) > 1:
    v1 = heapq.heappop(v)
    v2 = heapq.heappop(v)
    heapq.heappush(v,(v1+v2)/2)
print(heapq.heappop(v))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
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 I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  l.sort()
  a=(l[0]+l[1])/2

  for x in l[2:]:
    a=(a+x)/2

  return a

# main()
print(main())

Submission status: Accepted

Solution code:
#

import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop

def main():
    n = int(input())
    vl = list(map(int, input().split()))
    vl.sort()
    while len(vl) > 1:
        val = vl.pop(0)
        vl[0] = (vl[0] + val) / 2

    print(vl[0])

if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(s)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, v: "List[int]"):
    v.sort()
    curr = (v[0] + v[1])/2
    for i in range(2, N):
        curr = (curr + v[i])/2
    print(curr)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    v = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, v)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
v = na()
v.sort()

s = 0
for i in range(n):
    s = s * 0.5 + v[i]
    if i == 0:
        s += v[i]
print("{:.14f}".format(s*0.5))

Submission status: Accepted

Solution code:
from fractions import gcd
import math

mod = 1000000007


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    n =int(input())
    v = list(map(float, 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:
N = int(input())
vs = list(map(int, input().split()))

vs.sort()

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

print(ans)