結果

問題 No.1243 約数加算
ユーザー tamatotamato
提出日時 2020-10-02 22:31:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 596 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 11,076 KB
実行使用メモリ 275,348 KB
最終ジャッジ日時 2023-09-24 21:41:40
合計ジャッジ時間 4,405 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
12,212 KB
testcase_01 AC 16 ms
7,804 KB
testcase_02 AC 16 ms
7,792 KB
testcase_03 AC 16 ms
7,900 KB
testcase_04 AC 18 ms
8,496 KB
testcase_05 AC 22 ms
8,388 KB
testcase_06 AC 22 ms
8,504 KB
testcase_07 AC 19 ms
8,476 KB
testcase_08 AC 23 ms
8,500 KB
testcase_09 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    for _ in range(int(input())):
        A, B = map(int, input().split())
        NB = B.bit_length()
        i0 = NB - 1
        ans = []
        while A >> i0 & 1 == B >> i0 & 1:
            i0 -= 1
        A %= 1 << i0
        while A < (1 << i0):
            ans.append(A & -A)
            A += A & -A
        for i in range(i0-1, -1, -1):
            if A >> i & 1 != B >> i & 1:
                ans.append(1 << i)
        print(len(ans))
        print(*ans)


if __name__ == '__main__':
    main()
0