結果
問題 | No.2943 Sigma String of String Score Problem |
ユーザー |
![]() |
提出日時 | 2024-09-29 12:27:19 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 130 ms / 3,000 ms |
コード長 | 393 bytes |
コンパイル時間 | 6,107 ms |
コンパイル使用メモリ | 336,568 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-29 12:27:33 |
合計ジャッジ時間 | 8,372 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;using mint=modint998244353;int main(){string s,t;cin>>s>>t;int n=s.size(),m=t.size();vector<mint> dp(m+1),ara(m+1);mint g=2;dp[0]=1,ara[0]=1;for(int i=0;i<n;i++){for(int j=0;j<m;j++)if(s[i]==t[j])ara[j+1]+=dp[j];dp=ara;}cout<<(dp[m]*g.pow(n-m)).val()<<endl;}