結果

問題 No.1243 約数加算
ユーザー masa_aamasa_aa
提出日時 2020-10-02 22:08:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 76,624 KB
最終ジャッジ日時 2023-09-24 12:38:53
合計ジャッジ時間 1,941 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,292 KB
testcase_01 AC 67 ms
71,312 KB
testcase_02 AC 67 ms
71,308 KB
testcase_03 AC 72 ms
71,524 KB
testcase_04 AC 82 ms
76,584 KB
testcase_05 AC 77 ms
76,608 KB
testcase_06 AC 83 ms
76,616 KB
testcase_07 AC 79 ms
76,624 KB
testcase_08 AC 78 ms
76,420 KB
testcase_09 AC 66 ms
71,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
for _ in range(int(input())):
    a, b = map(int, input().split())
    k = b - a
    res = []
    for i in range(61):
        if k < 1 << i:
            break
        else:
            if a >> i & 1:
                a += 1 << i
                k -= 1 << i
                res.append(1 << i)
    for i in range(60, -1, -1):
        if k >> i & 1:
            res.append(1 << i)
    print(len(res))
    print(" ".join(map(str, res)))
0