結果

問題 No.638 Sum of "not power of 2"
ユーザー GrayCoderGrayCoder
提出日時 2018-01-28 18:41:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 438 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 10,652 KB
実行使用メモリ 8,008 KB
最終ジャッジ日時 2023-08-28 18:21:24
合計ジャッジ時間 942 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,964 KB
testcase_01 AC 15 ms
7,900 KB
testcase_02 AC 15 ms
7,920 KB
testcase_03 AC 15 ms
7,836 KB
testcase_04 AC 15 ms
7,848 KB
testcase_05 AC 15 ms
7,908 KB
testcase_06 AC 15 ms
7,936 KB
testcase_07 AC 15 ms
8,008 KB
testcase_08 AC 15 ms
7,936 KB
testcase_09 AC 15 ms
7,928 KB
testcase_10 AC 15 ms
7,920 KB
testcase_11 AC 15 ms
7,840 KB
testcase_12 AC 15 ms
7,864 KB
testcase_13 AC 15 ms
7,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def main():
    N = int(input())

    if N < 6:
        print(-1)
    elif not N & 1:
        print(3, N - 3)
    else:
        for i in (3, 5, 6):
            j = N - i
            n = 0
            while 1:
                k = 1 << n
                if k == j:
                    break
                elif k > j:
                    print(i, j)
                    return
                n += 1
        print(-1)

main()
0