結果
問題 | No.1243 約数加算 |
ユーザー |
|
提出日時 | 2020-10-02 22:15:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 58 ms / 2,000 ms |
コード長 | 559 bytes |
コンパイル時間 | 135 ms |
コンパイル使用メモリ | 82,588 KB |
実行使用メモリ | 70,500 KB |
最終ジャッジ日時 | 2024-07-17 21:32:38 |
合計ジャッジ時間 | 1,178 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
t=int(input())for _ in range(t):a,b=map(int,input().split())moves=[]cnt=0for i in range(1,100):if a%(2**i)==0:cnt=ielse:breakfor i in range(cnt,100):if 2**i<=(b-a):if (a//(2**i))%2==1:moves.append(2**i)a+=2**ielse:breakflag=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)