結果
問題 | No.811 約数の個数の最大化 |
ユーザー | lloyz |
提出日時 | 2022-05-26 22:15:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 520 ms / 2,000 ms |
コード長 | 617 bytes |
コンパイル時間 | 152 ms |
コンパイル使用メモリ | 81,828 KB |
実行使用メモリ | 86,164 KB |
最終ジャッジ日時 | 2023-10-20 19:34:14 |
合計ジャッジ時間 | 4,509 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
53,656 KB |
testcase_01 | AC | 46 ms
62,140 KB |
testcase_02 | AC | 461 ms
85,840 KB |
testcase_03 | AC | 36 ms
53,656 KB |
testcase_04 | AC | 44 ms
61,920 KB |
testcase_05 | AC | 53 ms
64,288 KB |
testcase_06 | AC | 63 ms
66,348 KB |
testcase_07 | AC | 74 ms
66,336 KB |
testcase_08 | AC | 223 ms
84,124 KB |
testcase_09 | AC | 230 ms
84,204 KB |
testcase_10 | AC | 150 ms
73,076 KB |
testcase_11 | AC | 445 ms
85,668 KB |
testcase_12 | AC | 122 ms
70,868 KB |
testcase_13 | AC | 520 ms
86,152 KB |
testcase_14 | AC | 510 ms
86,164 KB |
ソースコード
from math import gcd n, k = map(int, input().split()) F = [[] for _ in range(n)] for i in range(1, n): j = 1 while j * j <= i: if i % j != 0: j += 1 continue F[i].append(j) if j * j != i: F[i].append(i // j) j += 1 N = [1 for _ in range(n)] N[1] = 0 i = 2 while i * i < n: if N[i] != 1: i += 1 continue for j in range(i * 2, n, i): N[j] = N[i] + N[j // i] i += 1 max_, ans = 0, 0 for i in range(1, n): if N[gcd(i, n)] >= k and len(F[i]) > max_: ans = i max_ = len(F[i]) print(ans)