結果

問題 No.1243 約数加算
ユーザー Eki1009Eki1009
提出日時 2020-10-02 21:44:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 1,365 ms
コンパイル使用メモリ 10,552 KB
実行使用メモリ 7,920 KB
最終ジャッジ日時 2023-09-23 04:31:26
合計ジャッジ時間 1,195 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,788 KB
testcase_01 AC 17 ms
7,788 KB
testcase_02 AC 16 ms
7,856 KB
testcase_03 AC 16 ms
7,788 KB
testcase_04 AC 19 ms
7,920 KB
testcase_05 AC 22 ms
7,808 KB
testcase_06 AC 22 ms
7,828 KB
testcase_07 AC 19 ms
7,836 KB
testcase_08 AC 22 ms
7,752 KB
testcase_09 AC 16 ms
7,812 KB
権限があれば一括ダウンロードができます

ソースコード

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