結果

問題 No.1243 約数加算
ユーザー 👑 KazunKazun
提出日時 2020-10-02 22:45:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 341 bytes
コンパイル時間 1,186 ms
コンパイル使用メモリ 86,924 KB
実行使用メモリ 76,812 KB
最終ジャッジ日時 2023-09-24 22:11:01
合計ジャッジ時間 2,043 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,352 KB
testcase_01 AC 72 ms
71,172 KB
testcase_02 AC 70 ms
70,988 KB
testcase_03 AC 71 ms
71,164 KB
testcase_04 AC 84 ms
76,588 KB
testcase_05 AC 88 ms
76,764 KB
testcase_06 AC 89 ms
76,380 KB
testcase_07 AC 92 ms
76,812 KB
testcase_08 AC 93 ms
76,620 KB
testcase_09 AC 74 ms
71,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())

for _ in range(T):
    A,B=map(int,input().split())
    x=A

    X=[]
    while x+(x&(-x))<=B:
        X.append(x&(-x))
        x+=x&(-x)

    d=B-x
    while d:
        c=(d-1).bit_length()

        if c:
            z=1<<(c-1)
        else:
            z=1

        X.append(z)
        d-=z

    print(len(X))
    print(*X)
0