AtCoder Regular Contest 106
翻译中…
Problem Statement
翻译中…
Given is an integer $N$. Determine whether there is a pair of positive integers $(A, B)$ such that $3^A + 5^B = N$, and find one such pair if it exists.
翻译中…
Constraints
翻译中…
$1 \leq N \leq 10^{18}$- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
翻译中…
Output
翻译中…
If there is no pair $(A, B)$ that satisfies the condition, print -1.
翻译中…
If there is such a pair, print $A$ and $B$ of one such pair with space in between. If there are multiple such pairs, any of them will be accepted.
翻译中…
样例
Input #1
106
Output #1
4 2
We have $3^4 + 5^2 = 81 + 25 = 106$, so $(A, B) = (4, 2)$ satisfies the condition.
Input #2
1024
Output #2
-1
Input #3
10460353208
Output #3
21 1
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。