問題一覧 > 通常問題

No.638 Sum of "not power of 2"

レベル : / AI推定難易度 : 500 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 260
作問者 : square1001 / テスター : WA_TLE
お気に入りにしたユーザー ProblemId : 1852 / 自分の提出
問題文最終更新日: 2026-06-25 05:00:32
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 181 (順位表) の他の問題:

Problem Statement

You are given a positive integer $N$. Determine whether it can be expressed in the form $N = a + b$ (where $a, b$ are positive integers that cannot be expressed as an integer power of $2$), and if it can, find the pair $(a, b)$ that minimizes $a$.

Input

N

On line 1, an integer $N (1 \le N \le 10^{18})$ is given.

Output

If it can be expressed, print $a, b$ separated by a space in 1 line.
If it cannot be expressed, print -1.
In either case, end the output with a newline.

Sample

Sample 1
Input
5
Output
-1

Written as a sum of two positive integers, $5$ is one of $1 + 4, 2 + 3, 3 + 2, 4 + 1$, but each of these contains a number that can be expressed as an integer power of $2$.

Sample 2
Input
11
Output
5 6

$(a, b) = (5, 6), (6, 5)$ satisfy the conditions. The one with the smaller $a$ is $(a, b) = (5, 6)$, so print this.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。