結果
問題 | No.2131 Concon Substrings (COuNt Version) |
ユーザー | kotatsugame |
提出日時 | 2022-11-25 21:25:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 15 ms / 2,000 ms |
コード長 | 438 bytes |
コンパイル時間 | 643 ms |
コンパイル使用メモリ | 66,888 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-02 03:55:08 |
合計ジャッジ時間 | 1,469 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 16 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 7 | main() | ^~~~
ソースコード
#include<iostream> #include<atcoder/modint> using namespace std; using mint=atcoder::modint998244353; mint dp[2][3001]; int N; main() { cin>>N; int now=0; dp[now][0]=1; for(int i=0;i<N;i++) { int nxt=1-now; for(int j=0;j<=N;j++)dp[nxt][j]=0; for(int j=0;j<=i;j++) { dp[nxt][j]+=dp[now][j]*25; dp[nxt][j+1]+=dp[now][j]; } now=nxt; } mint ans=0; for(int j=0;j<=N;j++)ans+=j/3*dp[now][j]; cout<<ans.val()<<endl; }