結果

問題 No.1243 約数加算
ユーザー keijakkeijak
提出日時 2020-10-02 23:24:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 8,412 KB
最終ジャッジ日時 2023-09-24 23:36:20
合計ジャッジ時間 1,274 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,796 KB
testcase_01 AC 16 ms
7,816 KB
testcase_02 AC 16 ms
7,864 KB
testcase_03 AC 16 ms
7,920 KB
testcase_04 AC 22 ms
8,300 KB
testcase_05 AC 49 ms
7,840 KB
testcase_06 AC 58 ms
8,412 KB
testcase_07 AC 24 ms
8,264 KB
testcase_08 AC 61 ms
7,840 KB
testcase_09 AC 18 ms
7,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()


def solve():
    a, b = inl()
    r = b - a
    ans = []
    while r:
        da = 1
        while a % (2 * da) == 0 and 2 * da <= r:
            da *= 2
        ans.append(da)
        r -= da
        a += da
    print(len(ans))
    print(*ans)


t = ini()
for i in range(t):
    solve()
0