結果

問題 No.638 Sum of "not power of 2"
ユーザー brthyyjpbrthyyjp
提出日時 2020-06-29 08:03:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 1,000 ms
コード長 425 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 71,480 KB
最終ジャッジ日時 2023-09-25 04:16:18
合計ジャッジ時間 2,276 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,432 KB
testcase_01 AC 76 ms
71,356 KB
testcase_02 AC 73 ms
71,376 KB
testcase_03 AC 76 ms
71,480 KB
testcase_04 AC 79 ms
71,392 KB
testcase_05 AC 77 ms
71,108 KB
testcase_06 AC 75 ms
71,364 KB
testcase_07 AC 75 ms
71,312 KB
testcase_08 AC 74 ms
71,384 KB
testcase_09 AC 75 ms
71,304 KB
testcase_10 AC 77 ms
71,156 KB
testcase_11 AC 74 ms
71,476 KB
testcase_12 AC 73 ms
71,460 KB
testcase_13 AC 74 ms
71,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
i = 0
S = []
flag = False
while 2**i <= n:
    if 2**i == n:
        flag = True
    S.append(2**i)
    i += 1

T = set(S)
for a in S:
    b = n-a
    T.add(b)

if 0 in T:
    T.remove(0)
#print(T)

if not flag:
    if len(T) == n-1:
        print(-1)
        exit()
else:
    if len(T) == n:
        print(-1)
        exit()


for i in range(1, n+1):
    if i not in T:
        print(i, n-i)
        exit()
0