結果

問題 No.2636 No Waiting in Vain
ユーザー kemunikukemuniku
提出日時 2024-02-13 20:14:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 484 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 75,972 KB
最終ジャッジ日時 2024-02-18 12:30:47
合計ジャッジ時間 4,203 ms
ジャッジサーバーID
(参考情報)
judge15 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 36 ms
53,460 KB
testcase_02 AC 37 ms
53,460 KB
testcase_03 AC 36 ms
53,460 KB
testcase_04 AC 92 ms
75,972 KB
testcase_05 AC 93 ms
75,972 KB
testcase_06 AC 75 ms
75,972 KB
testcase_07 AC 93 ms
75,972 KB
testcase_08 AC 67 ms
75,972 KB
testcase_09 AC 93 ms
75,972 KB
testcase_10 AC 89 ms
75,972 KB
testcase_11 AC 58 ms
70,980 KB
testcase_12 AC 93 ms
75,972 KB
testcase_13 AC 93 ms
75,972 KB
testcase_14 AC 73 ms
75,972 KB
testcase_15 AC 92 ms
75,972 KB
testcase_16 AC 55 ms
64,788 KB
testcase_17 AC 93 ms
75,972 KB
testcase_18 AC 73 ms
75,972 KB
testcase_19 AC 93 ms
75,972 KB
testcase_20 AC 93 ms
75,972 KB
testcase_21 AC 93 ms
75,972 KB
testcase_22 AC 80 ms
75,972 KB
testcase_23 AC 90 ms
75,972 KB
testcase_24 AC 42 ms
59,512 KB
testcase_25 AC 43 ms
59,652 KB
testcase_26 AC 41 ms
59,524 KB
testcase_27 AC 45 ms
59,652 KB
testcase_28 AC 45 ms
61,720 KB
testcase_29 AC 42 ms
59,652 KB
testcase_30 AC 43 ms
59,652 KB
testcase_31 AC 44 ms
61,728 KB
testcase_32 AC 46 ms
59,652 KB
testcase_33 AC 44 ms
59,652 KB
testcase_34 AC 43 ms
59,652 KB
testcase_35 AC 42 ms
59,512 KB
testcase_36 AC 43 ms
59,652 KB
testcase_37 AC 42 ms
59,652 KB
testcase_38 AC 45 ms
61,724 KB
testcase_39 AC 42 ms
59,524 KB
testcase_40 AC 43 ms
59,652 KB
testcase_41 AC 43 ms
61,732 KB
testcase_42 AC 44 ms
61,728 KB
testcase_43 AC 43 ms
59,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
S = input()
MOD = 998244353
Candidate_Day = 0 #予定を入れても良い日
for i in range(N):
    if i != 0:
        if S[i] == "N" and S[i-1] != "C":
            Candidate_Day += 1
    else:
        if S[i] == "N":
            Candidate_Day += 1
ans = 0
tmp = 1
for i in range(1,S.count("N")-K+1):
    if Candidate_Day < i:
        break
    tmp *= (Candidate_Day-i+1)
    tmp *= pow(i,-1,MOD)
    tmp %= MOD
    ans += tmp
    ans %= MOD
print(ans)
0