結果
問題 |
No.1243 約数加算
|
ユーザー |
![]() |
提出日時 | 2020-10-02 21:58:31 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 93 ms / 2,000 ms |
コード長 | 740 bytes |
コンパイル時間 | 244 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-07-17 13:08:50 |
合計ジャッジ時間 | 1,271 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
import sys input = sys.stdin.readline T=int(input()) for tests in range(T): A,B=map(int,input().split()) ANS=[] while True: for i in range(80): if (1<<i)>B: target=(1<<(i-1)) break if A>target: A-=target B-=target else: break while A<target: X=A twos=1 while X%2==0: X//=2 twos*=2 ANS.append(twos) A+=twos B-=A while B!=0: for i in range(80): if (1<<i)>B: break ANS.append(1<<(i-1)) B-=1<<(i-1) print(len(ANS)) print(*ANS)