結果

問題 No.1243 約数加算
ユーザー tanon710tanon710
提出日時 2020-10-02 22:05:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 610 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 76,908 KB
最終ジャッジ日時 2023-09-24 12:31:58
合計ジャッジ時間 3,395 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 73 ms
71,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t=int(input())
for _ in range(t):
    a,b=map(int,input().split())
    moves=[]
    if a%2==0:
        for i in range(1,100):
            if 2**i<=(b-a):
                moves.append(2**i)
                a+=2**i
            else:
                break
    else:
        for i in range(100):
            if 2**i<=(b-a):
                moves.append(2**i)
                a+=2**i
            else:
                break
    flag=format(b-a,'b')
    l=len(flag)
    for i in range(l):
        if flag[i]=='1':
            moves.append(2**(l-i-1))
            a+=2**(l-i-1)
    print(len(moves))
    print(*moves)
0