結果
問題 | No.811 約数の個数の最大化 |
ユーザー | 👑 rin204 |
提出日時 | 2022-01-19 00:46:53 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 106 ms / 2,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 282 ms |
コンパイル使用メモリ | 86,964 KB |
実行使用メモリ | 77,996 KB |
最終ジャッジ日時 | 2023-08-15 07:47:16 |
合計ジャッジ時間 | 2,859 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 65 ms
70,908 KB |
testcase_01 | AC | 71 ms
75,936 KB |
testcase_02 | AC | 102 ms
77,488 KB |
testcase_03 | AC | 67 ms
71,092 KB |
testcase_04 | AC | 70 ms
75,928 KB |
testcase_05 | AC | 80 ms
76,248 KB |
testcase_06 | AC | 81 ms
76,260 KB |
testcase_07 | AC | 83 ms
76,284 KB |
testcase_08 | AC | 93 ms
77,168 KB |
testcase_09 | AC | 99 ms
77,104 KB |
testcase_10 | AC | 93 ms
76,892 KB |
testcase_11 | AC | 106 ms
77,792 KB |
testcase_12 | AC | 84 ms
76,720 KB |
testcase_13 | AC | 105 ms
77,992 KB |
testcase_14 | AC | 105 ms
77,996 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)