結果

問題 No.1809 Divide NCK
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-14 22:46:05
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 526 bytes
コンパイル時間 1,440 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 76,520 KB
最終ジャッジ日時 2023-08-12 21:19:34
合計ジャッジ時間 5,561 ms
ジャッジサーバーID
(参考情報)
judge11 / judge7
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
72,016 KB
testcase_01 AC 94 ms
75,956 KB
testcase_02 AC 80 ms
71,728 KB
testcase_03 AC 75 ms
71,408 KB
testcase_04 AC 76 ms
71,764 KB
testcase_05 AC 76 ms
71,872 KB
testcase_06 AC 77 ms
71,652 KB
testcase_07 AC 77 ms
71,984 KB
testcase_08 AC 76 ms
71,704 KB
testcase_09 AC 75 ms
71,864 KB
testcase_10 AC 75 ms
71,552 KB
testcase_11 AC 93 ms
76,088 KB
testcase_12 AC 94 ms
76,156 KB
testcase_13 AC 80 ms
76,252 KB
testcase_14 AC 84 ms
76,176 KB
testcase_15 AC 78 ms
75,944 KB
testcase_16 AC 88 ms
76,156 KB
testcase_17 AC 75 ms
76,232 KB
testcase_18 AC 86 ms
76,144 KB
testcase_19 AC 89 ms
76,196 KB
testcase_20 AC 88 ms
76,028 KB
testcase_21 AC 87 ms
76,304 KB
testcase_22 AC 74 ms
71,388 KB
testcase_23 AC 76 ms
71,604 KB
testcase_24 AC 76 ms
71,764 KB
testcase_25 AC 74 ms
71,740 KB
testcase_26 AC 73 ms
71,784 KB
testcase_27 AC 72 ms
71,912 KB
testcase_28 AC 73 ms
71,420 KB
testcase_29 AC 88 ms
76,244 KB
testcase_30 AC 92 ms
76,520 KB
testcase_31 AC 76 ms
76,212 KB
testcase_32 AC 86 ms
76,156 KB
testcase_33 AC 83 ms
76,204 KB
testcase_34 AC 88 ms
76,220 KB
testcase_35 AC 86 ms
76,252 KB
testcase_36 AC 84 ms
76,240 KB
testcase_37 AC 88 ms
76,128 KB
testcase_38 AC 83 ms
76,288 KB
testcase_39 AC 89 ms
76,276 KB
testcase_40 AC 89 ms
76,272 KB
testcase_41 AC 84 ms
76,180 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