結果

問題 No.1809 Divide NCK
ユーザー MasKoaTSMasKoaTS
提出日時 2021-12-09 15:57:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 1,431 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 75,656 KB
最終ジャッジ日時 2023-09-24 08:29:34
合計ジャッジ時間 6,029 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,424 KB
testcase_01 AC 74 ms
71,060 KB
testcase_02 AC 73 ms
71,312 KB
testcase_03 AC 72 ms
71,384 KB
testcase_04 AC 72 ms
71,320 KB
testcase_05 AC 72 ms
71,436 KB
testcase_06 AC 71 ms
71,384 KB
testcase_07 WA -
testcase_08 AC 72 ms
71,232 KB
testcase_09 AC 73 ms
71,428 KB
testcase_10 AC 73 ms
71,384 KB
testcase_11 AC 73 ms
71,232 KB
testcase_12 AC 74 ms
71,328 KB
testcase_13 WA -
testcase_14 AC 73 ms
71,324 KB
testcase_15 AC 73 ms
70,952 KB
testcase_16 AC 90 ms
75,404 KB
testcase_17 AC 77 ms
75,544 KB
testcase_18 AC 90 ms
75,344 KB
testcase_19 AC 92 ms
75,612 KB
testcase_20 AC 76 ms
75,428 KB
testcase_21 AC 73 ms
71,420 KB
testcase_22 AC 71 ms
71,328 KB
testcase_23 AC 72 ms
71,368 KB
testcase_24 AC 71 ms
71,384 KB
testcase_25 AC 71 ms
71,448 KB
testcase_26 AC 71 ms
71,088 KB
testcase_27 AC 72 ms
71,424 KB
testcase_28 WA -
testcase_29 AC 84 ms
75,200 KB
testcase_30 AC 76 ms
75,412 KB
testcase_31 AC 76 ms
75,296 KB
testcase_32 AC 72 ms
71,424 KB
testcase_33 AC 76 ms
75,332 KB
testcase_34 AC 75 ms
75,348 KB
testcase_35 AC 75 ms
75,656 KB
testcase_36 AC 76 ms
75,208 KB
testcase_37 AC 73 ms
71,088 KB
testcase_38 AC 72 ms
71,308 KB
testcase_39 AC 76 ms
71,292 KB
testcase_40 AC 74 ms
71,328 KB
testcase_41 AC 73 ms
70,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#嘘解法

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

def prime_factorize(n):
	prime = []
	f = 2
	while(f * f <= n):
		if(n % f == 0):
			n //= f
			cnt = 1
			while(n % f == 0):
				n //= f
				cnt += 1
			prime.append((f,cnt))
		else:
			f += 1
	if(n != 1):
		prime.append((n,1))
	return prime

def legendre(N,K,p,c):
	R = N - K
	cnt = 0
	while(N):
		N //= p
		cnt += N
	while(K):
		K //= p
		cnt -= K
	while(R):
		R //= p
		cnt -= R
	return -(-cnt // c)

prime = prime_factorize(M)
ans = 10 ** 18
for p,c in prime:
	cnt = legendre(N,K,p,c)
	if(ans > cnt):
		ans = cnt

print(ans)
0