Александр Куров, вольный слушатель CubeSum 729 | Ступеньков Валерий Олегович, 525 группа CubeSum 2093 | ||||
---|---|---|---|---|---|
f | 1 | n = int(input()) | f | 1 | n = int(input()) |
2 | a = 1 | 2 | a = 1 | ||
n | 3 | b = round(n ** (1 / 3)) | n | 3 | b = int(n ** (1 / 3)) |
4 | c = 0 | 4 | count = 0 | ||
5 | while a < b: | 5 | while a <= b: | ||
6 | n1 = a ** 3 + b ** 3 | 6 | cube_sum = a ** 3 + b ** 3 | ||
7 | if n1 > n: | 7 | if cube_sum > n: | ||
8 | b -= 1 | 8 | b -= 1 | ||
9 | else: | 9 | else: | ||
n | 10 | if n1 == n: | n | 10 | if cube_sum == n: |
11 | c += 1 | 11 | count += 1 | ||
12 | a += 1 | 12 | a += 1 | ||
t | 13 | print(c) | t | 13 | print(count) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|