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