题解 | #数组分组#
数组分组
https://www.nowcoder.com/practice/9af744a3517440508dbeb297020aca86
m = int(input()) o = list(map(int, input().split())) five = [] three = [] other = [] for x in o: if x % 5 == 0: five.append(x) elif x % 3 == 0: three.append(x) else: other.append(x) num1 = abs(sum(five) - sum(three)) num2 = sum(other) num3 = num1 + num2 if num3 % 2 == 0: num4 = num3 // 2 b = {0} for x in other: b = b | set(y+x for y in b) if num4 in b: print('true') else: print('false') else: print('false')