結果
| 問題 | No.3500 01 String |
| コンテスト | |
| ユーザー |
hir355
|
| 提出日時 | 2026-04-18 21:02:14 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 2,000 ms |
| コード長 | 313 bytes |
| 記録 | |
| コンパイル時間 | 483 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 65,280 KB |
| 最終ジャッジ日時 | 2026-04-18 21:02:36 |
| 合計ジャッジ時間 | 2,231 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
MOD = 998244353
n = int(input())
a = input()
ans = 1
for i in range(n - 1):
if a[i] == '0' and a[i + 1] == '1':
l = i
r = i + 1
while l >= 0 and a[l] == '0':
l -= 1
while r < n and a[r] == '1':
r += 1
ans *= (r - l)
ans %= MOD
print(ans)
hir355