ThreeSquares/Mik | ThreeSquares/artemkin1 | ||||
---|---|---|---|---|---|
f | 1 | import math | f | 1 | import math |
t | 2 | seq = set(eval(input())) | t | 2 | set0 = set(eval(input())) |
3 | maxs = max(seq) | 3 | M = max(set0) | ||
4 | squares = {i * i + j * j + k * k for i in range(1, int(math.sqrt(maxs)) + 1) for j in range(i, int(math.sqrt(maxs - i * i)) + 1) for k in range(j, int(math.sqrt(maxs - i * i - j * j)) + 1)} | 4 | set1 = {i * i + j * j + k * k for i in range(1, int(math.sqrt(M)) + 1) for j in range(i, int(math.sqrt(M - i * i)) + 1) for k in range(j, int(math.sqrt(M - i * i - j * j)) + 1)} | ||
5 | print(len(seq.intersection(squares))) | 5 | print(len(set0 & set1)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|