結果
| 問題 |
No.1243 約数加算
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-03-21 18:27:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,024 bytes |
| コンパイル時間 | 237 ms |
| コンパイル使用メモリ | 82,256 KB |
| 実行使用メモリ | 587,132 KB |
| 最終ジャッジ日時 | 2024-09-18 14:26:17 |
| 合計ジャッジ時間 | 4,469 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 2 MLE * 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(*ans)
rlangevin