結果
問題 |
No.2541 Divide 01 String
|
ユーザー |
|
提出日時 | 2023-11-25 10:23:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 69 ms / 2,000 ms |
コード長 | 255 bytes |
コンパイル時間 | 431 ms |
コンパイル使用メモリ | 82,520 KB |
実行使用メモリ | 89,556 KB |
最終ジャッジ日時 | 2024-09-26 10:15:20 |
合計ジャッジ時間 | 2,569 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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])