题解 | #记负均正II#

记负均正II

https://www.nowcoder.com/practice/64f6f222499c4c94b338e588592b6a62

b=[]
count,sum=0,0
while True:
    try:
        n=int(input())
        if n<0:
            count+=1
        elif n>0:
            b.append(n)
            sum+=n
    except:
        break
print(count)
if not b:
    print(0.0)
else:
    print("%.1f"%(sum/len(b)))

全部评论

相关推荐

1 收藏 评论
分享
牛客网
牛客企业服务