牛客华为机试HJ97
作者:互联网
1. 题目描述
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
标签:nums,int,pos,sys,牛客,input,print,机试,HJ97 来源: https://www.cnblogs.com/junstat/p/16181401.html