Данилов Роман, 321 группа CubeSum 692 | Шумицкая Екатерина, 522 группа CubeSum 1182 | ||||
---|---|---|---|---|---|
n | 1 | goal = int(input()) | n | 1 | n = int(input()) |
2 | st = 1 | 2 | a = 1 | ||
3 | fin = int(goal ** (1 / 3)) + 1 | 3 | b = int(n ** (1 / 3)) + 1 | ||
4 | ans = 0 | 4 | c = 0 | ||
5 | while st <= fin: | 5 | while a <= b: | ||
6 | if st ** 3 + fin ** 3 > goal: | 6 | if a ** 3 + b ** 3 > n: | ||
7 | fin -= 1 | 7 | b -= 1 | ||
8 | elif st ** 3 + fin ** 3 < goal: | 8 | elif a ** 3 + b ** 3 < n: | ||
9 | st += 1 | 9 | a += 1 | ||
10 | else: | 10 | else: | ||
t | 11 | ans += 1 | t | ||
12 | st += 1 | 11 | c += 1 | ||
12 | b -= 1 | ||||
13 | print(ans) | 13 | print(c) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|