結果

問題 No.1809 Divide NCK
ユーザー MasKoaTSMasKoaTS
提出日時 2021-12-08 21:31:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 59,400 KB
最終ジャッジ日時 2024-04-27 10:33:25
合計ジャッジ時間 2,614 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,408 KB
testcase_01 AC 32 ms
53,128 KB
testcase_02 AC 32 ms
52,744 KB
testcase_03 AC 33 ms
52,324 KB
testcase_04 WA -
testcase_05 AC 31 ms
52,952 KB
testcase_06 AC 33 ms
51,940 KB
testcase_07 AC 33 ms
53,152 KB
testcase_08 AC 32 ms
52,496 KB
testcase_09 AC 32 ms
52,320 KB
testcase_10 AC 31 ms
52,268 KB
testcase_11 AC 32 ms
52,980 KB
testcase_12 AC 31 ms
52,136 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 32 ms
52,068 KB
testcase_16 AC 46 ms
57,256 KB
testcase_17 AC 36 ms
57,996 KB
testcase_18 AC 46 ms
57,176 KB
testcase_19 AC 46 ms
57,948 KB
testcase_20 AC 34 ms
58,200 KB
testcase_21 AC 31 ms
52,948 KB
testcase_22 AC 31 ms
52,928 KB
testcase_23 AC 33 ms
52,892 KB
testcase_24 AC 32 ms
53,892 KB
testcase_25 AC 31 ms
52,468 KB
testcase_26 AC 32 ms
54,152 KB
testcase_27 AC 31 ms
54,288 KB
testcase_28 AC 31 ms
53,412 KB
testcase_29 AC 39 ms
57,716 KB
testcase_30 AC 33 ms
57,532 KB
testcase_31 AC 34 ms
58,828 KB
testcase_32 AC 32 ms
54,128 KB
testcase_33 AC 35 ms
58,804 KB
testcase_34 AC 36 ms
57,864 KB
testcase_35 AC 35 ms
59,056 KB
testcase_36 AC 35 ms
57,924 KB
testcase_37 AC 32 ms
52,740 KB
testcase_38 AC 34 ms
53,692 KB
testcase_39 AC 34 ms
52,808 KB
testcase_40 AC 34 ms
52,660 KB
testcase_41 AC 33 ms
53,736 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

prime = prime_factorize(M)
ans = 10 ** 18
for p,c in prime:
	cnt = 0
	n,k,r = N,K,N - K
	while(n):
		n //= p
		cnt += n
	while(k):
		k //= p
		cnt -= k
	while(r):
		r //= p
		cnt -= r
	cnt //= c
	if(ans > cnt):
		ans = cnt

print(ans)
0