結果
問題 | No.2016 Countdown Divisors |
ユーザー |
![]() |
提出日時 | 2022-07-22 21:40:05 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 784 bytes |
コンパイル時間 | 166 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 77,824 KB |
最終ジャッジ日時 | 2024-07-04 05:46:27 |
合計ジャッジ時間 | 3,938 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | AC * 1 TLE * 1 -- * 17 |
ソースコード
from collections import defaultdictd = defaultdict(int)def make_divisors(n):lower_divisors , upper_divisors = [], []i = 1while i*i <= n:if n % i == 0:lower_divisors.append(i)if i != n // i:upper_divisors.append(n//i)i += 1return lower_divisors + upper_divisors[::-1]t = int(input())for _ in range(t):n = int(input())nums = []while True:if d[n] :print(d[n])breakelse:dx = len(make_divisors(n))if n != dx:nums.append(n)n -= dxelse:print(n)d[n] = nfor num in nums:d[num] = nbreak