题解 | 记负均正

记负均正

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

import sys

n = input()
nums = [int(_) for _ in input().split(" ")]
fu = 0
ping = 0.0
ping_count = 0
for _ in nums:
    if _ < 0:
        fu += 1
    elif _ > 0:
        ping += _
        ping_count += 1
if not ping_count:
    ping_count = 1
print(fu,round(ping*1.0/ping_count*1.0,11))

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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