結果
| 問題 | No.2541 Divide 01 String | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2023-11-24 21:30:39 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 327 bytes | 
| コンパイル時間 | 1,853 ms | 
| コンパイル使用メモリ | 192,424 KB | 
| 最終ジャッジ日時 | 2025-02-17 23:46:59 | 
| ジャッジサーバーID (参考情報) | judge4 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 15 WA * 5 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll const m = 998244353;
int main () {
	int N;
	cin >> N;
	ll ans = 1;
	ll pre = -1;
	for (int i = 0; i < N; i ++) {
		char c;
		cin >> c;
		if (c == '1') {
			if (pre >= 0) {
				ans = (ans * (i - pre + 1)) % m;
			}
			pre = i;
		}
	}
	cout << ans << endl;
}
            
            
            
        