Written By: MathModel
The arithmetic mean of set of numbers a_1,a_2,..,a_n is :
In our problem , we don't consider non-positive numbers , so we count a_i>0 as — our count of numbers and accumulate the sum of such numbers , thus the answer is :
n=int(input())
a=list(map(float,input().split()))
cnt=0
s=0.0
for x in a:
if(x>0):
s+=x
cnt+=1
if(cnt==0):
print("Not Found")
else:
print(f"{s/cnt:.2f}")Complexity \mathcal{O}(\text{size}(\text{array})).