結果
| 問題 |
No.2541 Divide 01 String
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-24 21:27:35 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 321 bytes |
| コンパイル時間 | 555 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 86,716 KB |
| 最終ジャッジ日時 | 2024-09-26 08:51:26 |
| 合計ジャッジ時間 | 2,534 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 13 |
ソースコード
def rle(s):
n = len(s)
i = 0
r = []
while i < n:
j = i
while j < n and s[j] == s[i]:
j += 1
r.append((s[i], j - i))
i = j
return r
n = int(input())
s = input().strip('0')
n = len(s)
ans = 1
for i, j in rle(s):
if i == '0':
ans = (ans * (j + 2)) % 998244353
else:
ans = ans * j % 998244353
print(ans)