結果

問題 No.1809 Divide NCK
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-01-14 21:42:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 440 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 82,628 KB
実行使用メモリ 59,732 KB
最終ジャッジ日時 2024-04-30 13:40:01
合計ジャッジ時間 3,475 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
57,908 KB
testcase_01 AC 50 ms
58,588 KB
testcase_02 AC 49 ms
58,640 KB
testcase_03 AC 50 ms
58,352 KB
testcase_04 AC 49 ms
59,236 KB
testcase_05 AC 47 ms
58,240 KB
testcase_06 AC 49 ms
59,512 KB
testcase_07 AC 48 ms
58,128 KB
testcase_08 AC 53 ms
59,432 KB
testcase_09 AC 48 ms
58,828 KB
testcase_10 AC 49 ms
58,520 KB
testcase_11 AC 48 ms
59,212 KB
testcase_12 AC 47 ms
58,704 KB
testcase_13 AC 47 ms
57,788 KB
testcase_14 AC 47 ms
58,752 KB
testcase_15 AC 48 ms
57,640 KB
testcase_16 AC 48 ms
58,508 KB
testcase_17 AC 46 ms
59,220 KB
testcase_18 AC 47 ms
58,176 KB
testcase_19 AC 46 ms
57,852 KB
testcase_20 AC 50 ms
59,652 KB
testcase_21 AC 49 ms
58,616 KB
testcase_22 AC 48 ms
59,312 KB
testcase_23 AC 50 ms
59,292 KB
testcase_24 AC 49 ms
57,856 KB
testcase_25 AC 49 ms
58,732 KB
testcase_26 AC 50 ms
58,908 KB
testcase_27 AC 48 ms
57,788 KB
testcase_28 AC 50 ms
57,908 KB
testcase_29 AC 51 ms
58,296 KB
testcase_30 AC 48 ms
58,248 KB
testcase_31 AC 49 ms
59,208 KB
testcase_32 AC 51 ms
58,524 KB
testcase_33 AC 49 ms
58,380 KB
testcase_34 AC 49 ms
57,796 KB
testcase_35 AC 48 ms
57,576 KB
testcase_36 AC 48 ms
58,320 KB
testcase_37 AC 49 ms
58,316 KB
testcase_38 AC 49 ms
58,748 KB
testcase_39 AC 48 ms
59,732 KB
testcase_40 AC 48 ms
58,568 KB
testcase_41 AC 48 ms
58,420 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