結果
問題 |
No.1243 約数加算
|
ユーザー |
![]() |
提出日時 | 2020-10-02 21:52:52 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 705 bytes |
コンパイル時間 | 110 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 143,680 KB |
最終ジャッジ日時 | 2024-07-16 04:51:56 |
合計ジャッジ時間 | 5,798 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 1 WA * 2 TLE * 1 -- * 5 |
ソースコード
def make_divisors(n: int): lower_divisors, upper_divisors = [], [] i = 1 for i in range(1, int(n ** 0.5) + 1): if n % i == 0: lower_divisors.append(i) if i != n // i: upper_divisors.append(n // i) return lower_divisors + upper_divisors[::-1] def resolve(): from bisect import bisect_left t = int(input()) for _ in range(t): a, b = map(int, input().split()) b -= a l = make_divisors(a) ans = [] while b > 0: x = bisect_left(l, b + 1) - 1 ans.append(l[x]) b -= l[x] print(len(ans)) print(*ans) if __name__ == '__main__': resolve()