結果

問題 No.1243 約数加算
ユーザー Eki1009
提出日時 2020-10-02 21:44:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 483 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-16 04:37:10
合計ジャッジ時間 1,410 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

def f():
    a, b = map(int, input().split())
    L = []
    R = []
    cnt = 0
    while a < b:
        if a&1:
            L.append(2**cnt)
            a += 1
        if b&1:
            b -= 1
            R.append(2**cnt)
        a //= 2
        b //= 2
        cnt += 1
    res = L + R[::-1]
    print(len(res))
    print(*res)
t = int(input())
for _ in range(t):
    f()
0