結果

問題 No.2943 Sigma String of String Score Problem
ユーザー eve__fuyuki
提出日時 2024-10-19 14:47:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
MLE  
実行時間 -
コード長 562 bytes
コンパイル時間 2,167 ms
コンパイル使用メモリ 197,284 KB
最終ジャッジ日時 2025-02-24 21:33:36
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16 MLE * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

void fast_io() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
}

#include <atcoder/modint>
using mint = atcoder::modint998244353;
int main() {
	fast_io();
	string s, t;
	cin >> s >> t;
	int n = s.size(), m = t.size();
	mint dp[n + 1][m + 1] = {};
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= m; j++) {
			if (j < m && s[i] == t[j]) {
				dp[i + 1][j + 1] += dp[i][j];
			}
			dp[i + 1][j] += dp[i][j];
		}
	}
	mint ans = dp[n][m] * mint(2).pow(n - m);
	cout << ans.val() << endl;
}
0