题解 | #记负均正#

记负均正

https://www.nowcoder.com/practice/6abde6ffcc354ea1a8333836bd6876b8

import sys
num = int(input().strip())
uppernum,lowernum = [],[]
for line in sys.stdin:
    a = list(map(int,line.strip().split(" ")))
    for i in a:
        if i>0:
            uppernum.append(i)
        elif i<0:
            lowernum.append(i)
    if uppernum:
        re = round(sum(uppernum)/len(uppernum),1)
        print(len(lowernum),re)
    else:
        print(len(lowernum),0.0)

全部评论

相关推荐

06-02 15:53
阳光学院 Java
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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