結果

問題 No.638 Sum of "not power of 2"
ユーザー flippergo
提出日時 2024-12-03 10:16:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 1,000 ms
コード長 377 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 52,352 KB
最終ジャッジ日時 2024-12-03 10:16:43
合計ジャッジ時間 1,879 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

def check2(n):
    while n>1:
        if n%2==0:
            n //= 2
        else:
            return False
    return True
N = int(input())
a = 1
flag = -1
while 2*a<=N:
    if check2(a):
        a += 1
    else:
        b = N-a
        if check2(b):
            a += 1
        else:
            flag = (a,b)
            break
if flag==-1:
    print(-1)
else:
    print(*flag)
0