結果
問題 | No.1243 約数加算 |
ユーザー |
![]() |
提出日時 | 2023-03-21 18:28:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,012 bytes |
コンパイル時間 | 421 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 72,192 KB |
最終ジャッジ日時 | 2024-09-18 14:26:32 |
合計ジャッジ時間 | 4,104 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 2 TLE * 1 -- * 6 |
ソースコード
T = int(input()) for _ in range(T): A, B = map(int, input().split()) ans = [] nokori = 120 while A != B: while 2 * A <= B: ans.append(A) A *= 2 nokori -= 1 if B - A <= nokori: ans.extend([1] * (B - A)) break ind = 1 while A != B: # print(A, B, ans, sum(ans)) two = 2 ** ind # if (B - A)//(two//2) <= nokori: # ans.extend([two//2] * ((B - A)//(two//2) )) # break if A % two == 0: if A + A // two <= B: ans.append(A // two) A += A // two nokori -= 1 ind = 1 break else: ind += 1 else: A += two // 2 nokori -= 1 ans.append(two // 2) print(len(ans)) print(*ans)