結果

問題 No.2131 Concon Substrings (COuNt Version)
ユーザー nyyanyya
提出日時 2022-11-26 14:36:09
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 862 bytes
コンパイル時間 4,215 ms
コンパイル使用メモリ 227,272 KB
実行使用メモリ 38,656 KB
最終ジャッジ日時 2024-04-10 15:37:21
合計ジャッジ時間 4,269 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 20 ms
19,200 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 44 ms
38,656 KB
testcase_08 AC 12 ms
12,160 KB
testcase_09 AC 43 ms
38,528 KB
testcase_10 AC 43 ms
38,272 KB
testcase_11 AC 30 ms
27,776 KB
testcase_12 AC 29 ms
26,496 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 14 ms
13,696 KB
testcase_15 AC 11 ms
11,520 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 10 ms
10,624 KB
testcase_18 AC 10 ms
10,752 KB
testcase_19 AC 6 ms
7,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
//using mint = modint;
using mint = modint998244353;
using P = pair<int, int>;

const ll INF=1LL<<60, dx[]={0,1,0,-1},dy[]={1,0,-1,0};
template <typename T> inline bool chmin(T& a,const T&b) {if(a>b){a=b; return 1;} return 0;}
template <typename T> inline bool chmax(T& a,const T&b) {if(a<b){a=b; return 1;} return 0;}

int main(){

    int n;
    cin >> n;

    vector<vector<mint>> dp(n+1,vector<mint> (n+1));

    dp[0][0]=1;
    for(int i=1;i<n+1;i++) {
        dp[i][0]=dp[i-1][0]*25;
        for(int j=1;j<n+1;j++) {
            dp[i][j]=dp[i-1][j-1]+dp[i-1][j]*25;
        }
    }

    mint ans=0;
    rep(i,n+1){
        ans += dp[n][i]*(i/3);
    }
    cout << ans.val() << endl;

    return 0;
}
0