Last active
July 29, 2021 15:29
-
-
Save uchidama/63fd20ac87208e3e0ef9b739bee8b7b6 to your computer and use it in GitHub Desktop.
AtCoder Beginner Contest 166 [ D - I hate Factorization ] https://atcoder.jp/contests/abc166/tasks/abc166_d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| [問題] | |
| https://atcoder.jp/contests/abc166/tasks/abc166_d | |
| [解説] | |
| https://blog.hamayanhamayan.com/entry/2020/05/03/224316 | |
| https://img.atcoder.jp/abc166/editorial.pdf | |
| https://youtu.be/OCRLlMa7kL0?t=4226 | |
| [参考] | |
| https://atcoder.jp/contests/abc166/submissions/24604887 | |
| Xの制約条件 | |
| 1 <= X <= 10^9 | |
| なので、A^5 は、だいたい1000くらいまでだろ? | |
| という予想を元に総当たりをかける | |
| [結果] | |
| PyPy3 Ac 70ms | |
| ''' | |
| import sys | |
| sys.setrecursionlimit(10 ** 6) # 再帰上限の引き上げ | |
| input = sys.stdin.readline | |
| INF = 2 ** 63 - 1 | |
| X = int(input()) | |
| for A in range(1000): | |
| for B in range(-1000, 1000): | |
| if (A**5 - B**5) == X: | |
| print(A, B) | |
| exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment