脚本宝典收集整理的这篇文章主要介绍了牛客华为机试HJ97,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
原题传送门
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,请注明来意。