题解 | #记负均正#

记负均正

https://www.nowcoder.com/practice/6abde6ffcc354ea1a8333836bd6876b8?tpId=37&tqId=21320&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37&difficulty=undefined&judgeStatus=undefined&tags=&title=97

n = int(input())

nums = list(map(int, input().split(" ")))

neg = 0
act = 0
s = 0
for num in nums:
    if num < 0:
        neg += 1
    elif num > 0:
        act += 1
        s += num
print("{} {:.1f}".format(neg, s/act if act > 0 else 0))

全部评论

相关推荐

刘湘_passion:太强了牛肉哥有被激励到
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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