题解 | #记负均正II#
记负均正II
https://www.nowcoder.com/practice/64f6f222499c4c94b338e588592b6a62
fs=0 #负数统计个数
list1=[] #非负算平均值
while 1:
try:
x=int(input())
if x<0:
fs+=1
else:
list1.append(x)
if len(list1)==0:
out=0.0
else :
mean=sum(list1)/len(list1)
out=round(mean,1)
except:
break
print(fs)
print(out)
#华为od#
list1=[] #非负算平均值
while 1:
try:
x=int(input())
if x<0:
fs+=1
else:
list1.append(x)
if len(list1)==0:
out=0.0
else :
mean=sum(list1)/len(list1)
out=round(mean,1)
except:
break
print(fs)
print(out)
#华为od#