Почернина Ольга, 528 группа CubeSum 1446 | Ли Георгий Феликсович, 525 группа CubeSum 674 | ||||
---|---|---|---|---|---|
f | 1 | n = int(input()) | f | 1 | n = int(input()) |
n | 2 | i, j = (1, int(n ** (1 / 3))) | n | 2 | a, b = (1, int(n ** (1 / 3))) |
3 | count = 0 | 3 | pair_count = 0 | ||
4 | while i <= j: | 4 | while a <= b: | ||
5 | cube_sum = i ** 3 + j ** 3 | 5 | cubes_sum = a ** 3 + b ** 3 | ||
6 | if cube_sum < n: | 6 | if cubes_sum < n: | ||
7 | i += 1 | 7 | a += 1 | ||
8 | elif cube_sum > n: | 8 | elif cubes_sum > n: | ||
9 | j -= 1 | 9 | b -= 1 | ||
10 | else: | 10 | else: | ||
t | 11 | count += 1 | t | 11 | pair_count += 1 |
12 | i += 1 | 12 | a += 1 | ||
13 | j -= 1 | 13 | b -= 1 | ||
14 | print(count) | 14 | print(pair_count) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|