ThreeSquares/s9160605122 | ThreeSquares/maryam | ||||
---|---|---|---|---|---|
n | 1 | import math as m | n | 1 | import math |
2 | seq = set(eval(input())) | 2 | seq = set(eval(input())) | ||
t | 3 | M = max(seq) | t | 3 | maxseq = max(seq) |
4 | templt = {i * i + j * j + k * k for i in range(1, int(m.sqrt(M)) + 1) for j in range(i, int(m.sqrt(M - i * i)) + 1) for k in range(j, int(m.sqrt(M - i * i - j * j)) + 1)} | 4 | three_sqr = {i * i + j * j + k * k for i in range(1, int(math.sqrt(maxseq)) + 1) for j in range(i, int(math.sqrt(maxseq - i * i)) + 1) for k in range(j, int(math.sqrt(maxseq - i * i - j * j)) + 1)} | ||
5 | print(len(seq & templt)) | 5 | print(len(seq & three_sqr)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|