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