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