結果

問題 No.1243 約数加算
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-02-24 16:15:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 230 ms
コンパイル使用メモリ 81,676 KB
実行使用メモリ 73,564 KB
最終ジャッジ日時 2023-10-24 22:09:58
合計ジャッジ時間 1,415 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,352 KB
testcase_01 AC 38 ms
53,352 KB
testcase_02 AC 41 ms
53,352 KB
testcase_03 AC 41 ms
59,268 KB
testcase_04 AC 55 ms
66,240 KB
testcase_05 AC 60 ms
70,352 KB
testcase_06 AC 66 ms
73,172 KB
testcase_07 AC 56 ms
66,244 KB
testcase_08 AC 67 ms
73,564 KB
testcase_09 AC 41 ms
59,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)
def main(a,b):
  if b==a:return []
  if 2*a<=b:
    ret=[a]+main(2*a,b)
    return ret
  d=1
  while a+2*d<=b and a%(2*d)==0:
    d*=2
  ary=[d]+main(a+d,b)
  return ary

if __name__=='__main__':
  t=int(input())
  cases=[list(map(int,input().split())) for _ in range(t)]
  for a,b in cases:
    ret=main(a,b)
    print(len(ret))
    print(*ret)
0