Problem:


Score : 200 points

Problem Statement

Given is a sequence of N integers A_1, \ldots, A_N.

Find the (multiplicative) inverse of the sum of the inverses of these numbers, \frac{1}{\frac{1}{A_1} + \ldots + \frac{1}{A_N}}.

Constraints

1 \leq N \leq 100

1 \leq A_i \leq 1000

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \ldots A_N

Output

Print a decimal number (or an integer) representing the value of \frac{1}{\frac{1}{A_1} + \ldots + \frac{1}{A_N}}.

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
10 30

Sample Output 1

7.5

\frac{1}{\frac{1}{10} + \frac{1}{30}} = \frac{1}{\frac{4}{30}} = \frac{30}{4} = 7.5.

Printing 7.50001, 7.49999, and so on will also be accepted.

Sample Input 2

3
200 200 200

Sample Output 2

66.66666666666667

\frac{1}{\frac{1}{200} + \frac{1}{200} + \frac{1}{200}} = \frac{1}{\frac{3}{200}} = \frac{200}{3} = 66.6666....

Printing 6.66666e+1 and so on will also be accepted.

Sample Input 3

1
1000

Sample Output 3

1000

\frac{1}{\frac{1}{1000}} = 1000.

Printing +1000.0 and so on will also be accepted.



Sample input:
2
10 30


Sample output:
7.5

Submission status: Accepted

Solution code:
###==================================================
### import
#import bisect
#from collections import Counter, deque, defaultdict
#from copy import deepcopy
#from functools import reduce, lru_cache
#from heapq import heappush, heappop
#import itertools
#import math
#import string
import sys
### stdin
def input(): return sys.stdin.readline().rstrip()
def iIn(): return int(input())
def iInM(): return map(int, input().split())
def iInM1(): return map(int1, input().split())
def iInLH(): return list(map(int, input().split()))
def iInLH1(): return list(map(int1, input().split()))
def iInLV(n): return [iIn() for _ in range(n)]
def iInLV1(n): return [iIn()-1 for _ in range(n)]
def iInLD(n): return [iInLH() for _ in range(n)]
def iInLD1(n): return [iInLH1() for _ in range(n)]
def sInLH(): return list(input().split())
def sInLV(n): return [input().rstrip('\n') for _ in range(n)]
def sInLD(n): return [sInLH() for _ in range(n)]
### stdout
def OutH(lst, deli=' '): print(deli.join(map(str, lst)))
def OutV(lst): print('\n'.join(map(str, lst)))
### setting
sys.setrecursionlimit(10 ** 6)
### utils
int1 = lambda x: int(x) - 1
### constants
INF = int(1e9)
MOD = 1000000007
dx = (-1, 0, 1, 0)
dy = (0, -1, 0, 1)
###---------------------------------------------------

N = iIn()
A = iInLH()

den = 0
for i in range(N):
    den += 1.0 / A[i]
ans = 1.0 / den
print(ans)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    print(1/sum(map(lambda x: 1/x, A)))

if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
m = [1] * N
for i in range(0,len(A)):
    for j in range(0,len(A)):
        if i == j:
            continue
        else:
            m[i] *= A[j] 
print(m[0]*A[0]/sum(m))

Submission status: Accepted

Solution code:
#<B>
N = int(input())
A = list(map(int,input().split()))
ans = 0
for a in A:
    ans += 1/a

print(1/ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
sum_a_r = 0
def reciprocal(x):
  return 1 / x

for i in a:
  sum_a_r += reciprocal(i)
print(reciprocal(sum_a_r))

Submission status: Accepted

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

for i in range(n):
    t += 1 / a[i]

print(1 / t)

Submission status: Accepted

Solution code:
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
A = rl()

m = 1
for a in A:
	m *= a
s = 0
for a in A:
	s += m/a
print(m/s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = input()
    A = map(int, input().split())
    v = sum([1 / a for a in A])
    print(1 / v)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(float, input().split()))
    b = 0
    for i in a:
        b += 1 / i
    print(1 / b)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

denom = 0
for i in range(N):
    denom += 1/A[i]

print(1/denom)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

_ = ri()
def f(x):
  return 1/int(x)
print(1/sum(map(f, sys.stdin.readline().split())))

Submission status: Accepted

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

sm = 0.0
for i in range(N):
    sm += 1/A[i]

print(1/sm)

Submission status: Accepted

Solution code:
N = int(input())
S = list(map(int, input().split()))
S2 = list(map(lambda x: 1/x, S))
print(1/sum(S2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy
n = int(input())
a = numpy.array(list(map(int,input().split())))
print(1/(1/a).sum())

Submission status: Accepted

Solution code:
a = int(input())
b = list(map(int,input().split()[:a]))
c = 0
for i in range(0, len(b)):
    d = 1/b[i] 
    c += d
e = 1/c
print(e)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
 
from fractions import Fraction
def inverse(f):
    return Fraction(f.denominator,f.numerator)
 
ans = 0
for i in A:
    ans = ans + inverse(i)
 
print(float(inverse(ans)))

Submission status: Accepted

Solution code:
N = int(input())
print(1/sum([1/a for a in list(map(int,input().split()))]))

Submission status: Accepted

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

for a in A:
  ans+=1/a

print(1/ans)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
a = list(map(float, input().split()))
b = sum(np.reciprocal(a))
print(1/b)

Submission status: Accepted

Solution code:
input();print(1/sum([1/int(i) for i in input().split()]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input();print(1/sum([1/i for i in map(int,input().split())]))

Submission status: Accepted

Solution code:
_,l=open(0)
a=map(lambda x:1/int(x),l.split())
print(1/sum(a))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(lambda x:1/int(x),input().split()))
print(1/sum(a))

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
def gcd(*numbers): reduce(math.gcd, numbers)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
count = 0
ans = 0

N = i()
A = l()
for i in A:
    ans += 1/i

ans = 1/ans
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = map(int,input().split())
print(1/sum(1/i for i in A))

Submission status: Accepted

Solution code:
n = int(input())

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

r = [1/i for i in a]

print(1/sum(r))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
an = [int(num) for num in input().split()] 

answer = 0.0
for a in an:
  answer += 1.0/a

answer = 1/answer
print(answer)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
AA = []
for i in range(n):
    AA.append(1/A[i])

print(1/sum(AA))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, *a = map(int, open(0).read().split())
m = 1
for i in a:
    m *= i
print(m / sum(m // i for i in a))

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split());print(1/sum([1/x for x in a]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

# num is numerator
# den is denominator
num, den = A[0], 0

for i in A:
    num = (num * i) // math.gcd(num, i)

for i in A:
    den += num // i

ans = num / den
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
input()
print(1/sum([(1/i)  for i in list(map(int,input().split()))]))

Submission status: Accepted

Solution code:
import sys
from fractions import Fraction
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    a = list(map(int, input().split()))
    deno = 0
    for i in a:
        deno += Fraction(1, i)
    print(float(1/deno))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
print(1/sum([1/int(x) for x in input().split()]))

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
a=lmp()
ans=0
for i in a:
    ans+=1/i
print(1/ans)

Submission status: Accepted

Solution code:
N = int(input())
print(1/sum([1/int(x) for x in input().split()]))

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
A = LI()

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

print(1/a)

Submission status: Accepted

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

Submission status: Accepted

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

total1 = 0
total2 = 1
for i in range(N):
  total2 *= A[i]
for i in range(N):
  total1 += total2/A[i]
print(total2/total1)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
    x = 1 / A[i]
    lst.append(x)

print(1/sum(lst))

Submission status: Accepted

Solution code:
n=int(input())
ans=list(map(int,input().split()))
ansr=[1/i for i in ans]
print(1/sum(ansr))

Submission status: Accepted

Solution code:
N=int(input())
number=list(map(int,input().split()))
number_reverse=[1/i for i in number]
print(1/sum(number_reverse))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
a=map(lambda x:x**(-1),a)
ans=1/(sum(a))
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = map(int, input().split())
    inlis = list(map(int, input().split()))

    tmp = 0
    for i in range(len(inlis)):
        tmp += 1/inlis[i]
    print(1/tmp)
    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

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

product=1
div=0

for i in range(N):
    product*=A[i]
for j in range(N):
    div+=product/A[j]

print(product/div)

Submission status: Accepted

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

a1=[]
for i in range(n):
    a1.append(1/a[i])

print(1/sum(a1))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
lst=[]
for i in range(N):
    x = 1 / A[i]
    lst.append(x)

print(1/sum(lst))

Submission status: Accepted

Solution code:
n=int(input())
List=list(map(int,input().split()))
add=0
for i in List:
    add+=1/i
print(1/add)

Submission status: Accepted

Solution code:
from decimal import Decimal
n=int(input())
List=list(map(int,input().split()))
add=0
for i in List:
    add+=Decimal(1/i)
print(Decimal(1/add))

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())

    p = 1
    for a in A:
        p *= a

    denom = 0
    for a in A:
        denom += p // a

    print(p / denom)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# B - Resistors in Parallel
def main():
    _ = int(input())
    a = list(map(int, input().split()))
    t = 0

    for i in a:
        t += 1/i
    print(1/t)
    

if __name__ ==  "__main__":
    main()

Submission status: Accepted

Solution code:
from decimal import Decimal
N = int(input())
A = list(map(Decimal, input().split()))

ans = 0
for a in A:
  ans += Decimal(1) / a
print(float(Decimal(1) / ans))

Submission status: Accepted

Solution code:
def main():
    N = int(input())  
    A = list(map(int, input().split()))
    gyaku = 0
    for a in A:
        gyaku += 1/a
    print(1/gyaku)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

sum_a = 0

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

Submission status: Accepted

Solution code:
num = int(input())
r = [1/int(i) for i in input().split()]
print(1/sum(r))

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for i in A:
  ans += 1./i
print(1./ans)

Submission status: Accepted

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

sum = 0
for i in range(n):
    sum += 1 / a[i]

print(1 / sum)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
from decimal import Decimal as dec
s = 0
for i in range(n):
    s += dec(1 / a[i])
print(dec(1 / s))

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))
term = 0
for i in arr:
  term += 1/i
  
print(1/term)

Submission status: Accepted

Solution code:
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
a=int(input())
b=list(map(int,input().split()))
n=lcm_list(b)
m=0
for i in b:
    m+=n//i
print(n/m)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(lambda x :int(x)**(-1),input().split()))

print(sum(a)**(-1))

Submission status: Accepted

Solution code:
N=int(input())
list=list(map(float, input().split()))
c=0
for i in list:
    list[c]=1/(list[c])
    c+=1
ans=1/(sum(list))
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = [1/int(i) for i in input().split()]
print(1/sum(a))

Submission status: Accepted

Solution code:
n = int(input())
res = list(map(int, input().split()))
ans = 0 
for x in res:
  ans += 1/x
print(1/ans)

Submission status: Accepted

Solution code:
# 138 B

def inverse(y):
    return (1/y)

n = int(input())
a = list(map(int, input().split()))
sum = 0

for i in range(n):
    sum += inverse(a[i])
print(inverse(sum))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
print(1 / sum([1 / a for a in A]))

Submission status: Accepted

Solution code:
from fractions import Fraction as frac
input()
a = list(map(int,input().split()))
sm = frac("1/" + str(a[0]))
for i in range(1,len(a)):
    sm += frac("1/" + str(a[i]))
print(sm.denominator / sm.numerator)

Submission status: Accepted

Solution code:
a = int(input())
b = list(map(int, input().split()))
j = [1 / i for i in b]
print(1 / sum(j))

Submission status: Accepted

Solution code:
N=int(input())
S=0
A=list(map(int,input().split()))
for i in A:S+=1/i
print(1/S)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
den = 0
aseki = 1
for i in range(n):
    for j in range(n):
        if i != j:
            aseki *= a[j]
    den += aseki
    aseki = 1
fra = 1
for i in range(n):
    fra *=a[i]
print(fra/den)

Submission status: Accepted

Solution code:
a1=int(input())
a2=input()
res1=[i for i in a2.split()]
res=[i for i in a2.split()]
for x in res:
    if int(x)<1 or int(x)>1000:
        res.remove(x)
empty=0
sum_all=0
if 1<=a1<=100:
    if len(res1)==len(res):
        for x in res:
            empty=sum_all
            sum_all=empty+(1/int(x))
        print((1/sum_all))

Submission status: Accepted

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

print(1/sum(a))

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    ans = 0
    for a in A:
        ans += 1/a
    print(1/ans) 

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
def inpl(): return list(map(int, input().split()))
N = int(input())
print((1 / sum([1/a for a in inpl()])))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
#逆数を足すようの変数を用意して
v = 0.0
for i in a:
    #あとは逆数足していって
    v += 1.0 / i
#最後に逆数取るだけ
print(1.0 / v)

Submission status: Accepted

Solution code:
import statistics
n = int(input())
print(statistics.harmonic_mean(map(int, input().split())) / n)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(int,input().split()))
    sum = 0
    for i in a:
        sum += 1/i
    print(1/sum)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def resolve():
    N = int(input().strip())
    array = list(map(int, input().strip().split(' ')))
    rev_sum = 0
    for i in range(N):
        rev_sum = rev_sum + (1/array[i])
    ans = 1/rev_sum
    print(ans)
resolve()

Submission status: Accepted

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

ans = 0

for i in a:
    ans += 1/i

print(1/ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
v = 0.0
for i in a:
    v += 1.0 / i
print(1.0 / v)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
bunsi=1
for i in range(n):
  bunsi*=a[i]

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

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
x=0
for i in A:
  x+=1/i
print(1/x)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    tmp = 0
    for i in a:
        tmp += 1/i
    print(1/tmp)

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
a=[]
for i in range(n):
    a.append(1/l[i])
print(1/sum(a))

Submission status: Accepted

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

print(1/ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
gyaku = 0
for i in A:
    gyaku += 1/i
print(1/gyaku)

Submission status: Accepted

Solution code:
from fractions import Fraction
n=int(input())
a=[int(i) for i in input().split()]
def frac(n):
  return Fraction(1,n)
b=map(frac,a)
c=Fraction(1,sum(b))
print(float(c))

Submission status: Accepted

Solution code:
n=int(input())
l = list(map(int,input().split()))
a=1
for i in l:
    a=a*i
b=0
for i in l:
    b+=a/i
print(a/b)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
res = 1 / sum(map(lambda x: 1 / x, a))
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = 0
for i in a:
    b = b + 1 / i

print(1 / b)

Submission status: Accepted

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

Submission status: Accepted

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

for a in A:
    reverse += 1 / a

print(reverse**-1)

Submission status: Accepted

Solution code:
n=input();print(1/sum(1/int(i) for i in input().split()))

Submission status: Accepted

Solution code:
n=int(input())
print(1/sum(1/int(i) for i in input().split()))

Submission status: Accepted

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

ans = 0

for i in range(N):
    ans += 1 / LA[i]

fans = 1 / ans

print(fans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, pow(b, self.m-2, self.m))

    def pow(self, a, b):
        return pow(a, b, self.m)


@mt
def slv(M, A):
    from fractions import Fraction
    d = Fraction(0)
    for a in A:
        d += Fraction(1, a)

    return float(1 / d)





def main():
    N = read_int()
    A = read_int_n()
    print(slv(N, A))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
x=0
for i in A:
    x+=1/i
print(1/x)

Submission status: Accepted

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

sum=0
for a in alist:
    sum += 1 / a
print(1 / sum)

Submission status: Accepted

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

for i in range(N):
    B += 1/A[i]

print(1/B)

Submission status: Accepted

Solution code:
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
#sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    N = gete(int)
    A = tuple(geta(int))

    ans = sum([1 / ai for ai in A])

    print(1 / ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from fractions import Fraction
N = int(input())
a = list(map(int, input().split()))
total = 0
for i in a:
    total += Fraction(1, i)
print(float(Fraction(1, total)))

Submission status: Accepted

Solution code:
from fractions import Fraction
N = int(input())
A = [int(i) for i in input().split()]
print(float(1 / sum([Fraction(1, a) for a in A])))

Submission status: Accepted

Solution code:
from functools import reduce
from operator import mul
N = int(input())
A = [int(i) for i in input().split()]

prod = reduce(mul, A)
numerator = prod
denominator = sum([prod // a for a in A])
print(numerator / denominator)

Submission status: Accepted

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


answer=np.sum(1/a)
print(1/answer)

Submission status: Accepted

Solution code:
import numpy as np

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

answer = np.sum(1/A)
print(1/answer)

Submission status: Accepted

Solution code:
from decimal import Decimal
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


n = I()
a = LI()

bunbo = sum([Decimal(str(1 / i)) for i in a])
ans = Decimal(str(1 / bunbo))
print(float(ans))

Submission status: Accepted

Solution code:
N = int(input())
print(1/sum([1/int(a) for a in input().split()]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
p=0
for _ in range(n):
    p+=(1/a[_])
print("{:.6f}".format(1/p));

Submission status: Accepted

Solution code:
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:(input())

"""========main code==============="""
a=ii()
n=ll()
ans=0
for i in n:
    ans+=1/i
print(1/ans)

Submission status: Accepted

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

ans = 0
for ai in a:
  ans += (1 / ai)

print(1/ans)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
ans=0.0
d=0
for i in a:
    d=1/i
    ans+=d
print(1/ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    denom = 0
    for i in a:
        denom += (1 / i)
    print(1 / denom)
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a = map(int,input().split())
ans = 0
for i in a:
    ans += 1/i
print(1 / ans)

Submission status: Accepted

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

for i in range(N) : 
    B = 1 / A[i]
    ans += B

print(1/ans)

Submission status: Accepted

Solution code:
_ = int(input())
l = map(int, input().split())
t = 0
for i in l:
    t += 1/i
print(1/t)

Submission status: Accepted

Solution code:
N = int(input())
A = map(int, input().split())
print('{:.16g}'.format(1 / sum(1 / x for x in A)))

Submission status: Accepted

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

b = 1
for a in A:
    b *= a

C = [1 for _ in range(N)]
for i, a in enumerate(A):
    C[i] = b//a

print(b/sum(C))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
A = [int(x) for x in input().split()]
s = sum(1 / a for a in A)
print("{:.015f}".format(1 / s))

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())
a=np.array(list(map(int,input().split())))
bunnbo=np.sum(1/a)
print(1/bunnbo)

Submission status: Accepted

Solution code:
def main() -> None:
    _ = int(input())
    A = [int(x) for x in input().split()]
    s = sum(1 / a for a in A)
    print("{:.015f}".format(1 / s))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor


def main():
    #N, M = map(int, input().split())
    #N, K = map(int, input().split())

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

    allprod = 1
    for A in As:
        allprod *= A

    total = 0
    for A in As:
        total += allprod / A

    print(allprod / total)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor


def main():
    #N, M = map(int, input().split())
    #N, K = map(int, input().split())

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

    allprod = 1
    for A in As:
        allprod *= A
    
    total = 0
    for A in As:
        total += allprod / A

    print(allprod / total)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

c = 0
for i in range(n):
    c += 1/a[i]

print(1/c)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in a:
    ans += (i**-1)
print(1/ans)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
s=0
for i in l:
  s+=1/i
print(1/s)