結果

問題 No.638 Sum of "not power of 2"
コンテスト
ユーザー CreativeGP1
提出日時 2018-02-22 19:12:42
言語 PyPy2
(7.3.15)
結果
MLE  
(最新)
RE  
(最初)
実行時間 -
コード長 491 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 77,964 KB
最終ジャッジ日時 2025-12-04 00:57:13
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 8 MLE * 1 -- * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/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