結果

問題 No.1809 Divide NCK
ユーザー KudeKude
提出日時 2022-01-14 21:35:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 502 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 82,516 KB
実行使用メモリ 59,196 KB
最終ジャッジ日時 2024-04-30 13:12:04
合計ジャッジ時間 3,077 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,604 KB
testcase_01 AC 40 ms
52,284 KB
testcase_02 AC 38 ms
53,072 KB
testcase_03 AC 38 ms
52,868 KB
testcase_04 AC 38 ms
52,832 KB
testcase_05 AC 40 ms
52,800 KB
testcase_06 AC 40 ms
52,452 KB
testcase_07 AC 39 ms
52,800 KB
testcase_08 AC 39 ms
53,284 KB
testcase_09 AC 39 ms
53,352 KB
testcase_10 AC 38 ms
52,160 KB
testcase_11 AC 38 ms
53,148 KB
testcase_12 AC 37 ms
52,144 KB
testcase_13 AC 41 ms
58,468 KB
testcase_14 AC 39 ms
52,528 KB
testcase_15 AC 39 ms
52,868 KB
testcase_16 AC 57 ms
58,272 KB
testcase_17 AC 41 ms
57,948 KB
testcase_18 AC 55 ms
58,116 KB
testcase_19 AC 56 ms
58,512 KB
testcase_20 AC 41 ms
58,004 KB
testcase_21 AC 38 ms
52,608 KB
testcase_22 AC 38 ms
52,480 KB
testcase_23 AC 39 ms
52,068 KB
testcase_24 AC 38 ms
52,892 KB
testcase_25 AC 38 ms
51,944 KB
testcase_26 AC 38 ms
53,716 KB
testcase_27 AC 39 ms
52,884 KB
testcase_28 AC 38 ms
53,424 KB
testcase_29 AC 50 ms
57,936 KB
testcase_30 AC 41 ms
58,256 KB
testcase_31 AC 41 ms
58,576 KB
testcase_32 AC 41 ms
52,824 KB
testcase_33 AC 43 ms
58,268 KB
testcase_34 AC 42 ms
57,660 KB
testcase_35 AC 42 ms
58,184 KB
testcase_36 AC 41 ms
59,196 KB
testcase_37 AC 38 ms
52,528 KB
testcase_38 AC 39 ms
53,904 KB
testcase_39 AC 38 ms
52,200 KB
testcase_40 AC 39 ms
53,628 KB
testcase_41 AC 38 ms
52,776 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorize(x):
    ret = []
    p = 2
    while p * p <= x:
        cnt = 0
        while x % p == 0:
            x //= p
            cnt += 1
        if cnt:
            ret.append((p, cnt))
        p += 1
    if x > 1:
        ret.append((x, 1))
    return ret

def f(n, p):
    res = 0
    pk = p
    while pk <= n:
        res += n // pk
        pk *= p
    return res

n, k, m = map(int, input().split())
ans = min((f(n, p) - f(k, p) - f(n - k, p)) // cnt for p, cnt in factorize(m))
print(ans)
0