Данила Ковтун 530повс CubeSum 1699 | Лузик Дмитрий Евгеньевич, 527 группа CubeSum 3032 | ||||
---|---|---|---|---|---|
n | 1 | number = int(input()) | n | 1 | num = int(input()) |
2 | a = 1 | 2 | a = 1 | ||
n | 3 | b = round(number ** (1.0 / 3)) | n | 3 | b = int(num ** (1 / 3)) |
4 | count = 0 | 4 | cnt = 0 | ||
5 | while a < b: | 5 | while a < b: | ||
n | 6 | current = a ** 3 + b ** 3 | n | 6 | sum = a ** 3 + b ** 3 |
7 | if current > number: | 7 | if sum > num: | ||
8 | b -= 1 | 8 | b -= 1 | ||
n | 9 | elif current < number: | n | 9 | elif sum < num: |
10 | a += 1 | 10 | a += 1 | ||
11 | else: | 11 | else: | ||
n | 12 | count += 1 | n | 12 | cnt += 1 |
13 | a += 1 | 13 | a += 1 | ||
14 | b -= 1 | 14 | b -= 1 | ||
t | 15 | print(count) | t | 15 | print(cnt) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|