题解 | #相等序列#
相等序列
https://www.nowcoder.com/practice/7492dceb022a4bbebb990695c107823e
import sys k = int(input()) for i in range(k): n = int(input()) # 因为只能同步加减一次,说明数字的种类不能超过三种,超过三种无法满足一次 a = sorted(list(set(list(map(int,input().split()))))) if len(a)<3: print('YES') elif len(a)==3 and a[1]-a[0]==a[2]-a[1]: print('YES') else: print('NO')