結果

問題 No.1809 Divide NCK
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-14 22:46:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 182 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 59,828 KB
最終ジャッジ日時 2024-04-30 16:25:04
合計ジャッジ時間 3,134 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,448 KB
testcase_01 AC 59 ms
58,620 KB
testcase_02 AC 36 ms
53,256 KB
testcase_03 AC 36 ms
53,808 KB
testcase_04 AC 36 ms
52,556 KB
testcase_05 AC 40 ms
52,564 KB
testcase_06 AC 37 ms
53,464 KB
testcase_07 AC 37 ms
53,212 KB
testcase_08 AC 36 ms
52,444 KB
testcase_09 AC 36 ms
53,424 KB
testcase_10 AC 37 ms
53,360 KB
testcase_11 AC 52 ms
58,620 KB
testcase_12 AC 54 ms
58,340 KB
testcase_13 AC 44 ms
59,648 KB
testcase_14 AC 44 ms
58,404 KB
testcase_15 AC 40 ms
59,424 KB
testcase_16 AC 53 ms
59,292 KB
testcase_17 AC 40 ms
58,544 KB
testcase_18 AC 51 ms
58,428 KB
testcase_19 AC 53 ms
58,496 KB
testcase_20 AC 51 ms
58,584 KB
testcase_21 AC 51 ms
59,724 KB
testcase_22 AC 36 ms
52,748 KB
testcase_23 AC 37 ms
52,864 KB
testcase_24 AC 36 ms
52,516 KB
testcase_25 AC 36 ms
52,800 KB
testcase_26 AC 36 ms
53,404 KB
testcase_27 AC 36 ms
52,440 KB
testcase_28 AC 36 ms
52,504 KB
testcase_29 AC 51 ms
58,828 KB
testcase_30 AC 54 ms
59,828 KB
testcase_31 AC 42 ms
59,268 KB
testcase_32 AC 48 ms
58,176 KB
testcase_33 AC 46 ms
59,572 KB
testcase_34 AC 52 ms
58,884 KB
testcase_35 AC 50 ms
59,704 KB
testcase_36 AC 48 ms
58,784 KB
testcase_37 AC 53 ms
59,272 KB
testcase_38 AC 50 ms
58,836 KB
testcase_39 AC 55 ms
59,280 KB
testcase_40 AC 52 ms
58,984 KB
testcase_41 AC 48 ms
58,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k,m = map(int,input().split())

now = m


def count_divs(x,y):
    count = 0
    now = x
    while now <= y:
        count += y//now
        now *= x
    return count

ans = 10**20
for i in range(2,int(m**0.5)+1):
    if now%i:
        continue

    div = 0
    while now%i == 0:
        now //= i
        div += 1
    
    nc = count_divs(i,n)
    kc = count_divs(i,k) + count_divs(i,n-k)
    ans = min(ans,(nc-kc)//div)

if now != 1:
    ans = min(ans,count_divs(now,n)-count_divs(now,k)-count_divs(now,n-k))
print(ans)


0