牛客华为机试HJ97

发布时间:2022-06-08 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了牛客华为机试HJ97脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

原题传送门

1. 题目描述

牛客华为机试HJ97

2. Solution

import sys

if sys.platform != "linux":
    file_in = open("input/HJ97.txt")
    sys.stdin = file_in

while True:
    try:
        n = int(input().strip())
        nums = list(map(int, input().strip().split()))
        neg_nums = [x for x in nums if x < 0]
        pos_nums = [x for x in nums if x > 0]
        print(len(neg_nums), end=" ")
        if pos_nums:
            print(round(sum(pos_nums) / len(pos_nums), 1))
        else:
            print(0)
    except Exception as e:
        print(e)
        break

脚本宝典总结

以上是脚本宝典为你收集整理的牛客华为机试HJ97全部内容,希望文章能够帮你解决牛客华为机试HJ97所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: