题解 | 记负均正II

import sys

cnegative = 0
lother = []
while True:
    try:
        n = int(input())
        if n < 0:
            cnegative += 1
        else:
            lother.append(n)
    except:
        break

print(cnegative)

if len(lother) ==0:
    print(0.0)
else:
    print(round(sum(lother)/len(lother),1))



全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务