結果

問題 No.2530 Yellow Cards
ユーザー titiatitia
提出日時 2023-11-06 01:57:46
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 487 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 81,900 KB
実行使用メモリ 271,776 KB
最終ジャッジ日時 2023-11-06 01:57:51
合計ジャッジ時間 4,602 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
57,988 KB
testcase_01 AC 37 ms
53,600 KB
testcase_02 AC 157 ms
62,300 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,K=map(int,input().split())
mod=998244353

DP=[0]*(N+K)
DP[0]=1

INV=pow(N,-1,mod)

for i in range(K):
    for j in range(N+K-2,-1,-1):
        # 今まででたカードがi枚
        # yellow 二枚がj人
        # yellow一枚は
        one=i-j*2

        # one/Nで一人増え、それ以外では増えない
        DP[j+1]+=DP[j]*one*INV
        DP[j]=DP[j]*(1-one*INV)

ANS=0
for i in range(N+K-1):
    ANS+=DP[i]*(i+N)

print(ANS%mod)
0