题解 | #记负均正II#

记负均正II

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

num, negative, positive = [], [], []
while True:
    try:
        n = int(input())
        num.append(n)
    except:
        break
for i in num:
    if i > 0:
        positive.append(i)
    elif i < 0:
        negative.append(i)
print(len(negative))
if len(positive) != 0:
    print(round(sum(positive) / len(positive), 1))
else:
    print(0.0)

全部评论

相关推荐

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