106

AtCoder
IDarc106_a
Time2000ms
Memory256MB
Difficulty
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$ [samples]
Samples
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
API Response (JSON)
{
  "problem": {
    "name": "106",
    "description": {
      "content": "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.",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc106_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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.\n\n## Constraints\n\n*   $1 \\leq N \\leq 10^{18}$\n* ...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments