結果
問題 |
No.2131 Concon Substrings (COuNt Version)
|
ユーザー |
![]() |
提出日時 | 2022-11-25 21:24:57 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 2,000 ms |
コード長 | 549 bytes |
コンパイル時間 | 4,233 ms |
コンパイル使用メモリ | 253,264 KB |
最終ジャッジ日時 | 2025-02-08 23:44:34 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 int main(){ int n; cin>>n; vector<mint> dp(n+1,0); dp[0] = 1; rep(i,n){ vector<mint> ndp(n+1,0); rep(j,n+1){ ndp[j] += dp[j] * 25; if(j!=n)ndp[j+1] += dp[j]; } swap(dp,ndp); } mint ans = 0; rep(i,n+1){ ans += dp[i] * (i/3); } cout<<ans.val()<<endl; return 0; }