結果
問題 |
No.1243 約数加算
|
ユーザー |
|
提出日時 | 2024-06-07 10:52:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 568 bytes |
コンパイル時間 | 211 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 906,832 KB |
最終ジャッジ日時 | 2024-12-25 13:11:39 |
合計ジャッジ時間 | 21,384 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 2 TLE * 3 MLE * 4 |
ソースコード
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(*ans)