結果
| 問題 | No.2541 Divide 01 String |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-11-25 10:23:07 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 72 ms / 2,000 ms |
| コード長 | 255 bytes |
| 記録 | |
| コンパイル時間 | 165 ms |
| コンパイル使用メモリ | 84,608 KB |
| 実行使用メモリ | 94,080 KB |
| 最終ジャッジ日時 | 2026-04-13 13:03:51 |
| 合計ジャッジ時間 | 2,150 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
n = int(input())
S = list(map(int,input()))
mod = 998244353
dp = [1,0]
for s in S:
ndp = [0,0]
if s:
ndp[1] = (dp[1]*2 + dp[0]) % mod
else:
ndp[0] = (dp[0] + dp[1]) % mod
ndp[1] = dp[1]
dp = ndp
print(dp[1])