結果

問題 No.2381 Gift Exchange Party
ユーザー 👑 p-adicp-adic
提出日時 2023-07-15 00:04:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 176 bytes
コンパイル時間 2,508 ms
コンパイル使用メモリ 86,784 KB
実行使用メモリ 79,320 KB
最終ジャッジ日時 2023-10-14 14:29:44
合計ジャッジ時間 6,632 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,156 KB
testcase_01 AC 76 ms
71,104 KB
testcase_02 AC 86 ms
76,016 KB
testcase_03 AC 79 ms
75,812 KB
testcase_04 AC 80 ms
76,484 KB
testcase_05 AC 81 ms
77,136 KB
testcase_06 AC 79 ms
76,372 KB
testcase_07 AC 77 ms
76,396 KB
testcase_08 AC 80 ms
76,796 KB
testcase_09 AC 78 ms
75,544 KB
testcase_10 AC 77 ms
76,180 KB
testcase_11 AC 80 ms
76,620 KB
testcase_12 AC 78 ms
75,684 KB
testcase_13 AC 88 ms
76,240 KB
testcase_14 AC 97 ms
79,320 KB
testcase_15 AC 83 ms
76,628 KB
testcase_16 AC 82 ms
76,488 KB
testcase_17 AC 83 ms
77,104 KB
testcase_18 AC 81 ms
76,616 KB
testcase_19 AC 80 ms
76,752 KB
testcase_20 AC 228 ms
78,232 KB
testcase_21 AC 80 ms
77,304 KB
testcase_22 AC 228 ms
78,316 KB
testcase_23 AC 230 ms
78,256 KB
testcase_24 AC 81 ms
76,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,P=map(int,input().split())
Q=998244353
f=[1]*(N+1)
a=1
for i in range(1,N+1):
	a=(a*i)%Q
	f[i]=a
for i in range(N//P+1):a-=f[N]*pow(f[N-i*P]*f[i],-1,Q)*pow(P,-i,Q)
print(a%Q)
0