結果

問題 No.638 Sum of "not power of 2"
ユーザー CreativeGP1CreativeGP1
提出日時 2018-02-22 19:12:42
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 491 bytes
コンパイル時間 533 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 06:29:57
合計ジャッジ時間 1,229 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
6,816 KB
testcase_01 AC 10 ms
6,944 KB
testcase_02 AC 10 ms
6,940 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 9 ms
6,944 KB
testcase_05 AC 11 ms
6,944 KB
testcase_06 AC 11 ms
6,944 KB
testcase_07 AC 10 ms
6,940 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 10 ms
6,944 KB
testcase_13 AC 10 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
from operator import itemgetter
n = int(sys.stdin.readline().split(' ')[0])

def s2(n):
    if n <= 1:
        if n == 1: return True
        else: return False
    else: return s2(n / 2.)

can = []
for i in range(n-1):
    can.append((i+1, n-(i+1)))

can = filter(lambda ((x, y)): not s2(x) and not s2(y), can)
can = sorted(can, key=itemgetter(0))
if len(can) == 0:
    print("-1")
else:
    print("%d %d" % (can[0][0], can[0][1]))
0