結果

問題 No.1809 Divide NCK
ユーザー MasKoaTSMasKoaTS
提出日時 2021-12-09 13:01:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 531 bytes
コンパイル時間 527 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 75,596 KB
最終ジャッジ日時 2023-09-24 06:19:29
合計ジャッジ時間 4,633 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,276 KB
testcase_01 AC 62 ms
71,184 KB
testcase_02 AC 63 ms
71,316 KB
testcase_03 AC 60 ms
71,172 KB
testcase_04 AC 60 ms
71,324 KB
testcase_05 AC 61 ms
71,104 KB
testcase_06 AC 61 ms
70,956 KB
testcase_07 AC 59 ms
71,340 KB
testcase_08 AC 61 ms
71,368 KB
testcase_09 AC 60 ms
71,312 KB
testcase_10 AC 59 ms
71,144 KB
testcase_11 AC 61 ms
71,284 KB
testcase_12 AC 65 ms
71,152 KB
testcase_13 AC 78 ms
75,292 KB
testcase_14 AC 66 ms
71,264 KB
testcase_15 AC 60 ms
71,316 KB
testcase_16 AC 76 ms
75,472 KB
testcase_17 AC 61 ms
75,236 KB
testcase_18 AC 74 ms
75,468 KB
testcase_19 AC 75 ms
75,236 KB
testcase_20 AC 63 ms
75,216 KB
testcase_21 AC 58 ms
71,308 KB
testcase_22 AC 59 ms
71,336 KB
testcase_23 AC 60 ms
71,268 KB
testcase_24 AC 61 ms
71,432 KB
testcase_25 AC 59 ms
71,104 KB
testcase_26 AC 63 ms
71,104 KB
testcase_27 AC 58 ms
71,276 KB
testcase_28 WA -
testcase_29 AC 69 ms
75,188 KB
testcase_30 AC 62 ms
75,256 KB
testcase_31 AC 62 ms
75,252 KB
testcase_32 AC 63 ms
71,484 KB
testcase_33 AC 64 ms
75,248 KB
testcase_34 AC 62 ms
75,020 KB
testcase_35 WA -
testcase_36 AC 62 ms
75,340 KB
testcase_37 AC 64 ms
71,156 KB
testcase_38 AC 61 ms
71,072 KB
testcase_39 AC 64 ms
71,100 KB
testcase_40 WA -
testcase_41 WA -
権限があれば一括ダウンロードができます

ソースコード

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 = legendre(N,K,prime[-1][0],prime[-1][1])

print(ans)
0