結果

問題 No.1243 約数加算
ユーザー marroncastlemarroncastle
提出日時 2020-10-03 04:36:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 76,676 KB
最終ジャッジ日時 2023-09-25 04:41:29
合計ジャッジ時間 2,088 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,336 KB
testcase_01 AC 69 ms
71,076 KB
testcase_02 AC 71 ms
71,504 KB
testcase_03 AC 71 ms
71,320 KB
testcase_04 AC 90 ms
76,676 KB
testcase_05 AC 90 ms
76,676 KB
testcase_06 AC 89 ms
76,584 KB
testcase_07 AC 90 ms
76,436 KB
testcase_08 AC 87 ms
76,584 KB
testcase_09 AC 71 ms
71,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,os,io
input = sys.stdin.readline
#input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

T = int(input())
for t in range(T):
# from itertools import groupby, accumulate, product, permutations, combinations
# for com in combinations(range(1,100),2):
  # A,B = com
  # print(A,B)
  A, B = map(int, input().split())
  n = B.bit_length()
  m = A.bit_length()
  ans = []
  for i in range(n-1):
    if A&(1<<i):
      if A+(1<<i)>B:
        break
      A += 1<<i
      ans.append(1<<i)
  for i in range(n-2,-1,-1):
    if B&(1<<i) and not A&(1<<i):
      ans.append(1<<i)
  print(len(ans))
  print(*ans)
0