結果

問題 No.1243 約数加算
ユーザー rlangevinrlangevin
提出日時 2023-03-22 08:52:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 385 bytes
コンパイル時間 1,459 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 68,460 KB
最終ジャッジ日時 2023-10-18 18:50:09
合計ジャッジ時間 3,036 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,424 KB
testcase_01 AC 39 ms
53,424 KB
testcase_02 AC 39 ms
53,424 KB
testcase_03 AC 40 ms
53,424 KB
testcase_04 AC 58 ms
66,392 KB
testcase_05 AC 62 ms
68,460 KB
testcase_06 AC 58 ms
66,396 KB
testcase_07 AC 58 ms
66,396 KB
testcase_08 AC 59 ms
66,396 KB
testcase_09 AC 39 ms
53,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    A, B = map(int, input().split())
    ans = []
    for i in range(61):
        two = 1 << i
        if A & two and A + two <= B:
            ans.append(two)
            A += two
    
    for i in range(61, -1, -1):
        two = 1 << i
        if A + two <= B:
            ans.append(two)
            A += two

    print(len(ans))
    print(*ans)
0