結果
問題 | No.811 約数の個数の最大化 |
ユーザー |
👑 |
提出日時 | 2022-01-19 00:46:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 83 ms / 2,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 607 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 66,048 KB |
最終ジャッジ日時 | 2024-11-23 13:39:05 |
合計ジャッジ時間 | 2,006 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
51,968 KB |
testcase_01 | AC | 46 ms
59,648 KB |
testcase_02 | AC | 81 ms
65,920 KB |
testcase_03 | AC | 37 ms
51,968 KB |
testcase_04 | AC | 42 ms
58,880 KB |
testcase_05 | AC | 54 ms
64,000 KB |
testcase_06 | AC | 54 ms
64,512 KB |
testcase_07 | AC | 54 ms
63,872 KB |
testcase_08 | AC | 65 ms
65,024 KB |
testcase_09 | AC | 67 ms
64,768 KB |
testcase_10 | AC | 62 ms
64,640 KB |
testcase_11 | AC | 80 ms
65,408 KB |
testcase_12 | AC | 59 ms
64,000 KB |
testcase_13 | AC | 83 ms
66,048 KB |
testcase_14 | AC | 81 ms
66,048 KB |
ソースコード
from math import gcd n, k = map(int, input().split()) primes = [1] * (n + 1) cnt_s = [0] * (n + 1) primes[0] = 0 for i in range(2, n + 1): if primes[i] != 1: continue for j in range(i, n + 1, i): cnt = 0 J = j while j % i == 0: j //= i cnt += 1 primes[J] *= (cnt + 1) cnt_s[J] += cnt max_ = 0 ans = -1 for i in range(1, n): g = gcd(n, i) if cnt_s[g] < k: continue if primes[i] > max_: max_ = primes[i] ans = i print(ans)