結果
問題 |
No.2131 Concon Substrings (COuNt Version)
|
ユーザー |
|
提出日時 | 2022-11-27 20:24:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 88 ms / 2,000 ms |
コード長 | 532 bytes |
コンパイル時間 | 2,139 ms |
コンパイル使用メモリ | 198,588 KB |
最終ジャッジ日時 | 2025-02-09 01:38:31 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
ソースコード
#include<bits/stdc++.h> using namespace std; const int mod=998244353; void ch(long long &a,long long b){ a=(a+b)%mod; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; vector<vector<long long>>dp(N,vector<long long>(N+1)); dp[0][0]=25,dp[0][1]=1; for(int i=0;i<N-1;i++){ for(int j=0;j<=N;j++){ ch(dp[i+1][j],25ll*dp[i][j]); if(j!=N)ch(dp[i+1][j+1],dp[i][j]); } } long long ans=0; for(long long i=0;i<=N;i++){ ch(ans,i/3*dp[N-1][i]); } cout<<ans<<'\n'; }