题解 | 牛牛的数学作业

牛牛的数学作业

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

from sys import stdin,stdout,setrecursionlimit
from math import *
from functools import *
from bisect import bisect_left
input = stdin.readline
# print = stdout.write
setrecursionlimit(1000000)

for _ in range(int(input())):
    n = int(input())
    l = [int(i) for i in input().split()]
    average_1 = sum(l)/n
    var = sum([(i-average_1)**2 for i in l])/n
    print(max(l)-min(l),f"{var:.3f}")

全部评论

相关推荐

10-13 13:42
门头沟学院 Java
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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