题解 | 元素方碑

元素方碑

https://www.nowcoder.com/practice/5c6e7ed4726e41f4ac99a4dedf1e5bb2

n = int(input())
for _ in range(n):
    m = int(input())
    ls = list(map(int,input().split()))
    if len(ls)>1:
        a = ls[::2]
        b = ls[1::2]
        if sum(a)/len(a)==sum(b)/len(b) and sum(ls)%m==0:
            print("YES")
        else:
            print("NO")
    else:
        print("YES")

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

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