結果

問題 No.3500 01 String
コンテスト
ユーザー Ian
提出日時 2026-04-18 20:44:46
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 234 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 559 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 16,092 KB
最終ジャッジ日時 2026-04-18 20:44:58
合計ジャッジ時間 5,588 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 1 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

MOD = 998244353

N = int(input())
A = input().strip()

ans = 1
i = 0

while i < N:
    j = i
    while j + 1 < N and A[j] != A[j+1]:
        j += 1

    length = j - i + 1
    ans = ans * (length + 1) % MOD

    i = j + 1

print(ans)
0