結果

問題 No.1243 約数加算
ユーザー ayaoniayaoni
提出日時 2020-11-27 01:37:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 76,728 KB
最終ジャッジ日時 2023-10-01 03:46:57
合計ジャッジ時間 2,469 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,432 KB
testcase_01 AC 71 ms
71,192 KB
testcase_02 AC 88 ms
71,216 KB
testcase_03 AC 70 ms
71,236 KB
testcase_04 AC 86 ms
76,720 KB
testcase_05 AC 86 ms
76,628 KB
testcase_06 AC 87 ms
76,728 KB
testcase_07 AC 84 ms
76,544 KB
testcase_08 AC 85 ms
76,632 KB
testcase_09 AC 70 ms
71,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())


T = I()
for _ in range(T):
    A,B = MI()
    ANS = []
    while A+(A & (-A)) <= B:
        ANS.append(A & (-A))
        A += A & (-A)
    l = B.bit_length()
    for i in range(l-1,-1,-1):
        if (B>>i) & 1 and not (A>>i) & 1:
            ANS.append(1<<i)
    print(len(ANS))
    print(*ANS)
0