結果

問題 No.1809 Divide NCK
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-01-14 21:42:29
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 1,779 ms
コンパイル使用メモリ 86,804 KB
実行使用メモリ 75,940 KB
最終ジャッジ日時 2023-08-12 18:34:46
合計ジャッジ時間 7,118 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 90 ms
75,472 KB
testcase_01 AC 90 ms
75,616 KB
testcase_02 AC 91 ms
75,656 KB
testcase_03 AC 91 ms
75,508 KB
testcase_04 AC 89 ms
75,588 KB
testcase_05 AC 89 ms
75,476 KB
testcase_06 AC 90 ms
75,600 KB
testcase_07 AC 90 ms
75,680 KB
testcase_08 AC 90 ms
75,656 KB
testcase_09 AC 89 ms
75,560 KB
testcase_10 AC 89 ms
75,588 KB
testcase_11 AC 90 ms
75,668 KB
testcase_12 AC 89 ms
75,368 KB
testcase_13 AC 87 ms
75,588 KB
testcase_14 AC 90 ms
75,472 KB
testcase_15 AC 89 ms
75,496 KB
testcase_16 AC 87 ms
75,492 KB
testcase_17 AC 88 ms
75,636 KB
testcase_18 AC 87 ms
75,580 KB
testcase_19 AC 87 ms
75,480 KB
testcase_20 AC 93 ms
75,552 KB
testcase_21 AC 88 ms
75,576 KB
testcase_22 AC 90 ms
75,592 KB
testcase_23 AC 90 ms
75,584 KB
testcase_24 AC 90 ms
75,600 KB
testcase_25 AC 91 ms
75,684 KB
testcase_26 AC 88 ms
75,940 KB
testcase_27 AC 91 ms
75,560 KB
testcase_28 AC 91 ms
75,468 KB
testcase_29 AC 92 ms
75,668 KB
testcase_30 AC 91 ms
75,684 KB
testcase_31 AC 91 ms
75,664 KB
testcase_32 AC 90 ms
75,380 KB
testcase_33 AC 90 ms
75,812 KB
testcase_34 AC 90 ms
75,504 KB
testcase_35 AC 90 ms
75,820 KB
testcase_36 AC 91 ms
75,700 KB
testcase_37 AC 91 ms
75,320 KB
testcase_38 AC 89 ms
75,692 KB
testcase_39 AC 92 ms
75,644 KB
testcase_40 AC 91 ms
75,672 KB
testcase_41 AC 91 ms
75,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def cont(x,M):

    ret = 0
    div = M
    while x >= div:
        ret += x // div
        div *= M
    return ret

N,K,M = map(int,input().split())

q = {}
for i in range(2,10**6+1):

    if M % i == 0:
        q[i] = 0
        while M % i == 0:
            M //= i
            q[i] += 1

if M != 1:
    q[M] = 1

ans = float("inf")
for mod in q:
    ans =  min( ans , (cont(N,mod) - cont(K,mod) - cont(N-K,mod)) // q[mod] )
print (ans)
0