結果

問題 No.1243 約数加算
ユーザー sepa38sepa38
提出日時 2023-03-20 11:25:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 354 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 73,076 KB
最終ジャッジ日時 2023-10-18 18:02:46
合計ジャッジ時間 1,345 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,544 KB
testcase_01 AC 37 ms
53,544 KB
testcase_02 AC 37 ms
53,544 KB
testcase_03 AC 37 ms
53,544 KB
testcase_04 AC 70 ms
71,012 KB
testcase_05 AC 61 ms
68,632 KB
testcase_06 AC 62 ms
68,632 KB
testcase_07 AC 73 ms
73,076 KB
testcase_08 AC 61 ms
68,628 KB
testcase_09 AC 37 ms
53,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
  a, b = map(int, input().split())
  ans = []
  for i in range(60):
    x = b - a
    if x - (1 << i) >= (1 << i) and a & ((1 << (i + 1)) - 1):
      ans.append(1<<i)
      a += 1 << i
  for i in reversed(range(60)):
    x = b - a
    if x & (1 << i):
      ans.append(1<<i)
      a += 1 << i
  print(len(ans))
  print(*ans)
0