結果

問題 No.1809 Divide NCK
ユーザー ああいいああいい
提出日時 2022-01-14 22:57:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 643 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 82,556 KB
実行使用メモリ 73,772 KB
最終ジャッジ日時 2024-04-30 16:44:01
合計ジャッジ時間 4,393 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
72,792 KB
testcase_01 AC 69 ms
72,476 KB
testcase_02 AC 71 ms
72,956 KB
testcase_03 AC 68 ms
72,760 KB
testcase_04 AC 69 ms
73,368 KB
testcase_05 AC 69 ms
73,008 KB
testcase_06 AC 70 ms
73,520 KB
testcase_07 AC 72 ms
72,896 KB
testcase_08 AC 68 ms
72,460 KB
testcase_09 AC 67 ms
72,088 KB
testcase_10 AC 66 ms
72,700 KB
testcase_11 AC 66 ms
72,832 KB
testcase_12 AC 65 ms
73,072 KB
testcase_13 AC 68 ms
72,580 KB
testcase_14 AC 66 ms
73,176 KB
testcase_15 AC 68 ms
72,776 KB
testcase_16 AC 65 ms
72,256 KB
testcase_17 AC 66 ms
72,864 KB
testcase_18 AC 67 ms
72,940 KB
testcase_19 AC 68 ms
72,536 KB
testcase_20 AC 69 ms
72,936 KB
testcase_21 AC 66 ms
72,784 KB
testcase_22 AC 68 ms
73,772 KB
testcase_23 AC 68 ms
72,620 KB
testcase_24 AC 67 ms
72,528 KB
testcase_25 AC 71 ms
72,676 KB
testcase_26 AC 69 ms
71,944 KB
testcase_27 AC 67 ms
72,140 KB
testcase_28 AC 72 ms
73,496 KB
testcase_29 AC 68 ms
72,472 KB
testcase_30 AC 67 ms
72,520 KB
testcase_31 AC 70 ms
73,748 KB
testcase_32 AC 69 ms
72,592 KB
testcase_33 AC 70 ms
72,976 KB
testcase_34 AC 72 ms
73,136 KB
testcase_35 AC 66 ms
73,236 KB
testcase_36 AC 67 ms
73,708 KB
testcase_37 AC 68 ms
73,184 KB
testcase_38 AC 67 ms
72,336 KB
testcase_39 AC 69 ms
72,148 KB
testcase_40 AC 67 ms
73,520 KB
testcase_41 AC 70 ms
72,484 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