結果
| 問題 |
No.1243 約数加算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-07 10:53:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 588 bytes |
| コンパイル時間 | 504 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 719,164 KB |
| 最終ジャッジ日時 | 2024-12-25 13:13:42 |
| 合計ジャッジ時間 | 21,498 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 2 TLE * 2 MLE * 5 |
ソースコード
def make_divisors(n):
lower_divisors, upper_divisors = [], []
i = 1
while i**2 <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n // i)
i += 1
return lower_divisors + upper_divisors[::-1]
T = int(input())
for _ in range(T):
a, b = map(int, input().split())
divs = make_divisors(a)
ans = []
while a < b:
while a + divs[-1] > b:
divs.pop()
a += divs[-1]
ans.append(divs[-1])
assert a == b
print(len(ans))
print(*ans)