結果

問題 No.1809 Divide NCK
ユーザー ああいいああいい
提出日時 2022-01-14 22:57:01
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 545 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 84,288 KB
最終ジャッジ日時 2023-08-12 21:38:56
合計ジャッジ時間 6,820 ms
ジャッジサーバーID
(参考情報)
judge11 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
83,728 KB
testcase_01 AC 109 ms
83,840 KB
testcase_02 AC 107 ms
84,088 KB
testcase_03 AC 107 ms
83,836 KB
testcase_04 AC 107 ms
84,156 KB
testcase_05 AC 109 ms
83,716 KB
testcase_06 AC 111 ms
83,792 KB
testcase_07 AC 107 ms
83,900 KB
testcase_08 AC 110 ms
83,812 KB
testcase_09 AC 108 ms
83,736 KB
testcase_10 AC 108 ms
83,796 KB
testcase_11 AC 109 ms
83,776 KB
testcase_12 AC 108 ms
83,684 KB
testcase_13 AC 109 ms
84,088 KB
testcase_14 AC 110 ms
83,832 KB
testcase_15 AC 114 ms
83,932 KB
testcase_16 AC 111 ms
84,288 KB
testcase_17 AC 109 ms
83,796 KB
testcase_18 AC 110 ms
83,792 KB
testcase_19 AC 107 ms
83,876 KB
testcase_20 AC 108 ms
84,028 KB
testcase_21 AC 106 ms
83,800 KB
testcase_22 AC 107 ms
84,036 KB
testcase_23 AC 108 ms
84,284 KB
testcase_24 AC 107 ms
84,268 KB
testcase_25 AC 105 ms
83,800 KB
testcase_26 AC 109 ms
83,836 KB
testcase_27 AC 108 ms
83,840 KB
testcase_28 AC 107 ms
83,788 KB
testcase_29 AC 108 ms
83,720 KB
testcase_30 AC 107 ms
83,892 KB
testcase_31 AC 110 ms
83,896 KB
testcase_32 AC 107 ms
83,828 KB
testcase_33 AC 109 ms
83,808 KB
testcase_34 AC 110 ms
83,816 KB
testcase_35 AC 109 ms
83,932 KB
testcase_36 AC 111 ms
83,904 KB
testcase_37 AC 106 ms
83,780 KB
testcase_38 AC 110 ms
84,032 KB
testcase_39 AC 109 ms
83,796 KB
testcase_40 AC 107 ms
83,792 KB
testcase_41 AC 108 ms
83,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

C =10 ** 6 + 1
dat = [0] * C
prime = dict()
for i in range(2,C):
    if dat[i] == 0:
        for j in range(2 * i,C,i):
            dat[j] = 1
        if M % i == 0:
            count = 0
            while M % i == 0:
                count += 1
                M //= i
            prime[i] = count
if M != 1:
    prime[M] = 1
_min = 10 ** 9
def count(t,p):
    ans = 0
    i = p
    while t // i:
        ans += t // i
        i *= p
    return ans
for p in prime:
    a = count(N,p)
    b = count(K,p)
    c = count(N-K,p)
    d = a - b - c
    e = d // prime[p]
    if e < _min:
        _min = e
print(_min)
0