結果

問題 No.638 Sum of "not power of 2"
ユーザー qibqib
提出日時 2023-01-25 21:51:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 1,000 ms
コード長 322 bytes
コンパイル時間 284 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 71,556 KB
最終ジャッジ日時 2023-09-09 06:43:30
合計ジャッジ時間 2,157 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,556 KB
testcase_01 AC 70 ms
71,372 KB
testcase_02 AC 70 ms
71,392 KB
testcase_03 AC 69 ms
71,000 KB
testcase_04 AC 71 ms
71,064 KB
testcase_05 AC 68 ms
71,372 KB
testcase_06 AC 72 ms
71,224 KB
testcase_07 AC 71 ms
71,208 KB
testcase_08 AC 71 ms
71,352 KB
testcase_09 AC 72 ms
71,132 KB
testcase_10 AC 72 ms
71,316 KB
testcase_11 AC 72 ms
71,400 KB
testcase_12 AC 72 ms
71,036 KB
testcase_13 AC 72 ms
71,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

ng = set()
for i in range(61):
  ng.add(1 << i)

for i in range(1, 61):
  a = 1 + (1 << i)
  b = n - a
  if b <= 0:
    break
  elif not b in ng:
    print(f"{a} {b}")
    exit()
  else:
    a += 1
    b -= 1
    if b > 0 and not a in ng and not b in ng:
      print(f"{a} {b}")
      exit()

print("-1")
0