题解 | 元素方碑

元素方碑

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

import sys

t = int(sys.stdin.readline())
for _ in range(t):
    n, a = int(sys.stdin.readline()), list(map(int, sys.stdin.readline().split()))
    if sum(a) % n == 0:
        s = sum(a[i] for i in range(1, n, 2))
        print("YES" if s == sum(a) // n * (n // 2) else "NO")
    else:
        print("NO")

全部评论

相关推荐

02-25 19:38
门头沟学院 Java
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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