| Светлана Глаголева M-105 ФКИ CubeSum 2531 | Михальцов Данила, 528 CubeSum 395 | ||||
|---|---|---|---|---|---|
| n | 1 | N = int(input()) | n | 1 | n = int(input()) |
| 2 | A = 1 | 2 | a = 1 | ||
| 3 | B = round(N ** (1 / 3)) | 3 | b = int(n ** (1 / 3)) | ||
| 4 | count = 0 | 4 | ans = 0 | ||
| 5 | while A <= B: | 5 | while a <= b: | ||
| 6 | F = A ** 3 + B ** 3 | 6 | res = a ** 3 + b ** 3 | ||
| 7 | if F > N: | 7 | if res > n: | ||
| 8 | B -= 1 | 8 | b -= 1 | ||
| 9 | elif F < N: | 9 | elif res < n: | ||
| 10 | A += 1 | 10 | a += 1 | ||
| 11 | else: | 11 | else: | ||
| t | 12 | count += 1 | t | 12 | ans += 1 |
| 13 | B -= 1 | 13 | a += 1 | ||
| 14 | print(count) | 14 | print(ans) | ||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||