結果

問題 No.1243 約数加算
ユーザー KudeKude
提出日時 2020-10-02 22:16:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,160 KB
実行使用メモリ 77,124 KB
最終ジャッジ日時 2023-09-24 21:05:58
合計ジャッジ時間 1,960 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,452 KB
testcase_01 AC 75 ms
71,348 KB
testcase_02 AC 72 ms
71,384 KB
testcase_03 AC 72 ms
71,388 KB
testcase_04 AC 89 ms
76,908 KB
testcase_05 AC 90 ms
76,836 KB
testcase_06 AC 91 ms
76,620 KB
testcase_07 AC 96 ms
77,124 KB
testcase_08 AC 92 ms
76,516 KB
testcase_09 AC 71 ms
71,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    a, b = map(int, input().split())
    ans = []
    for d in range(100):
        bit = 1 << d
        if a & bit:
            if a + bit <= b:
                a += bit
                ans.append(bit)
            else:
                break
    rest = b - a
    for d in range(rest.bit_length() - 1, -1, -1):
        bit = 1 << d
        if rest & bit:
            ans.append(bit)
    print(len(ans))
    print(*ans)
0