結果

問題 No.811 約数の個数の最大化
ユーザー convexineqconvexineq
提出日時 2021-03-22 22:46:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 814 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 78,084 KB
最終ジャッジ日時 2023-08-16 02:10:46
合計ジャッジ時間 2,702 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,528 KB
testcase_01 AC 77 ms
76,196 KB
testcase_02 AC 90 ms
78,064 KB
testcase_03 AC 72 ms
71,352 KB
testcase_04 AC 76 ms
76,304 KB
testcase_05 AC 79 ms
76,604 KB
testcase_06 AC 82 ms
76,604 KB
testcase_07 AC 83 ms
76,676 KB
testcase_08 AC 86 ms
77,312 KB
testcase_09 AC 86 ms
77,348 KB
testcase_10 AC 84 ms
76,996 KB
testcase_11 AC 88 ms
77,712 KB
testcase_12 AC 83 ms
77,064 KB
testcase_13 AC 90 ms
77,876 KB
testcase_14 AC 90 ms
78,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
yaku = [0]*n
for i in range(2,n):
    for j in range(i,n,i):
        yaku[j] += 1

cnt = [0]*n
for i in range(n):
    if yaku[i] == 1 and n%i==0:
        nn = n
        v = i
        while nn%i==0:
            nn //= i
            for j in range(v,n,v):
                cnt[j] += 1
            v *= i

ans = 0
val = 0
for i in range(n):
    if cnt[i] >= k and val < yaku[i]:
        val = yaku[i]
        ans = i
print(ans)
0