Find a pair of integers (A,B) such that A**5 − B**5 =X for a given integer X..this is from atcoder beginner level contest...How to solve this ? I checked the editorial but it's not clear.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3993 |
2 | jiangly | 3743 |
3 | orzdevinwang | 3707 |
4 | Radewoosh | 3627 |
5 | jqdai0815 | 3620 |
6 | Benq | 3564 |
7 | Kevin114514 | 3443 |
8 | ksun48 | 3434 |
9 | Rewinding | 3397 |
10 | Um_nik | 3396 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 156 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
Find a pair of integers (A,B) such that A**5 − B**5 =X for a given integer X..this is from atcoder beginner level contest...How to solve this ? I checked the editorial but it's not clear.
Название |
---|
Try all $$$A$$$ from $$$-1000$$$ to $$$1000$$$ and $$$B$$$ from $$$-1000$$$ to $$$1000$$$, print anything that works.
There are limited number of possible combinations one can possible devise. for example if you take 500 for A and even if you subtract from even largest number 499 , you still be getting number > 10**9,so going till 500 is not required . Just check combinations till 126 as some have said in the discussion, i did with 1000
You can rewrite the expression as b^5=a^5-x now you can run loop on a from 0 to x^(1/5) and filter those values of a for which a^5-x is perfect 5th power of some integer. From this you can find pair a,b which satisfy given condition.