結果
問題 | No.811 約数の個数の最大化 |
ユーザー |
![]() |
提出日時 | 2024-09-03 02:35:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 176 ms / 2,000 ms |
コード長 | 604 bytes |
コンパイル時間 | 318 ms |
コンパイル使用メモリ | 82,492 KB |
実行使用メモリ | 78,088 KB |
最終ジャッジ日時 | 2024-09-03 02:35:46 |
合計ジャッジ時間 | 2,721 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
from collections import Counterfrom math import gcddef factorize(n):p = 2while p * p <= n:while n % p == 0:yield pn //= pp += 1if n > 1:yield ndef number_of_divisors(n: int) -> int:res = 1for k, v in Counter(factorize(n)).items():res *= v+1return resN, K = map(int, input().split())dmax = 0ans = 0for i in range(1, N):g = gcd(i, N)np = len(list(factorize(g)))if np >= K:nd = number_of_divisors(i)if dmax < nd:dmax = ndans = iprint(ans)