No.2541 Divide 01 String
レベル :
/ AI推定難易度 : 750
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 133
作問者 :
Shirotsume
/ テスター :
👑
p-adic
👑
Nachia
タグ : / 解いたユーザー数 133
作問者 :
Nachia
問題文最終更新日: 2023-11-18 20:43:20
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 413
(順位表)
の他の問題:
Problem Statement
You are given a string $S$ of length $N$ consisting of 0 and 1.
There are $2^{N-1}$ ways in total to divide the string $S$ into $1$ or more non-empty contiguous strings. Among them, how many ways are there such that every resulting string contains at least $1$ 1?
Print the answer modulo $998244353$.
Constraints
- $2 \leq N \leq 2 \times 10^5$
- $S$ is a string of length $N$ consisting of
0and1
Input
The input is given from standard input in the following format.
$N$ $S$
Output
Print the answer modulo $998244353$.
Sample
Sample 1
Input
3 101
Output
3
The valid ways to divide are the following $3$: dividing into 10, 1; dividing into 1, 01; and dividing into 101.
Sample 2
Input
3 010
Output
1
The only valid way to divide is the following $1$: dividing into 010.
Sample 3
Input
20 01001010101001010110
Output
7776
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。