結果

問題 No.1809 Divide NCK
ユーザー rlangevinrlangevin
提出日時 2023-02-02 12:45:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 96 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 963 ms
コンパイル使用メモリ 86,464 KB
実行使用メモリ 75,756 KB
最終ジャッジ日時 2023-09-14 19:25:32
合計ジャッジ時間 6,263 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,668 KB
testcase_01 AC 95 ms
75,324 KB
testcase_02 AC 78 ms
71,588 KB
testcase_03 AC 77 ms
71,532 KB
testcase_04 AC 78 ms
71,400 KB
testcase_05 AC 77 ms
71,464 KB
testcase_06 AC 77 ms
71,716 KB
testcase_07 AC 76 ms
71,536 KB
testcase_08 AC 78 ms
71,668 KB
testcase_09 AC 78 ms
71,524 KB
testcase_10 AC 77 ms
71,468 KB
testcase_11 AC 91 ms
75,344 KB
testcase_12 AC 96 ms
75,332 KB
testcase_13 AC 83 ms
75,648 KB
testcase_14 AC 85 ms
75,392 KB
testcase_15 AC 83 ms
75,436 KB
testcase_16 AC 96 ms
75,340 KB
testcase_17 AC 79 ms
75,392 KB
testcase_18 AC 94 ms
75,540 KB
testcase_19 AC 96 ms
75,352 KB
testcase_20 AC 92 ms
75,512 KB
testcase_21 AC 91 ms
75,180 KB
testcase_22 AC 76 ms
71,668 KB
testcase_23 AC 77 ms
71,732 KB
testcase_24 AC 76 ms
71,724 KB
testcase_25 AC 75 ms
71,732 KB
testcase_26 AC 78 ms
71,580 KB
testcase_27 AC 77 ms
71,556 KB
testcase_28 AC 79 ms
71,692 KB
testcase_29 AC 92 ms
75,248 KB
testcase_30 AC 93 ms
75,128 KB
testcase_31 AC 82 ms
75,404 KB
testcase_32 AC 90 ms
75,340 KB
testcase_33 AC 89 ms
75,656 KB
testcase_34 AC 92 ms
75,756 KB
testcase_35 AC 91 ms
75,328 KB
testcase_36 AC 87 ms
75,612 KB
testcase_37 AC 93 ms
75,616 KB
testcase_38 AC 88 ms
75,248 KB
testcase_39 AC 93 ms
75,408 KB
testcase_40 AC 93 ms
75,404 KB
testcase_41 AC 89 ms
75,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
 
    if temp != 1:
        arr.append([temp, 1])

    return arr

def f(n, p):
    val = 0
    m = p
    while n // m:
        val += n // m
        m *= p
    return val

N, K, M = map(int, input().split())
ans = 10 ** 18
for m, cnt in factorization(M):
    ans = min(ans, (f(N, m) - f(K, m) - f(N - K, m))//cnt )
print(ans)
0