結果

問題 No.1964 sum = length
ユーザー harurunharurun
提出日時 2022-04-21 20:27:44
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 1,111 bytes
コンパイル時間 3,311 ms
コンパイル使用メモリ 180,228 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-05 02:44:31
合計ジャッジ時間 7,748 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 5 ms
4,380 KB
testcase_15 AC 7 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 41 ms
4,376 KB
testcase_23 AC 38 ms
4,380 KB
testcase_24 AC 16 ms
4,380 KB
testcase_25 AC 20 ms
4,380 KB
testcase_26 AC 45 ms
4,380 KB
testcase_27 AC 26 ms
4,384 KB
testcase_28 AC 19 ms
4,380 KB
testcase_29 AC 32 ms
4,376 KB
testcase_30 AC 20 ms
4,380 KB
testcase_31 AC 45 ms
4,376 KB
testcase_32 AC 9 ms
4,380 KB
testcase_33 AC 8 ms
4,380 KB
testcase_34 AC 37 ms
4,384 KB
testcase_35 AC 12 ms
4,380 KB
testcase_36 AC 24 ms
4,380 KB
testcase_37 AC 32 ms
4,380 KB
testcase_38 AC 48 ms
4,376 KB
testcase_39 AC 20 ms
4,376 KB
testcase_40 AC 21 ms
4,380 KB
testcase_41 AC 41 ms
4,380 KB
testcase_42 AC 52 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <string>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <stdio.h>
#include <math.h>
#include <assert.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using namespace std;
using ll=long long;
#define read(x) cin>>(x);
#define readll(x) ll (x);cin>>(x);
#define readS(x) string (x);cin>>(x);
#define readvll(x,N) vector<ll> (x)((N));for(int i=0;i<(N);i++){cin>>(x)[i];}


int main(){
  int n;
  cin>>n;
  vector<ll> C(2*n);
  ll a=1;
  ll digit=0;
  ll f=10;
  while(a-digit<=2*n-1){
    C[a-digit]++;
    a++;
    if(a%f==0){
      digit++;
      f*=10;
    }
  }
  const ll mod=998244353;
  vector<vector<ll>> dp(n+1,vector<ll>(2*n));
  dp[0][0]=1;
  for(ll i=0;i<n;i++){
    for(ll j=0;j<2*n;j++){
      for(ll k=1;k<2*n;k++){
        if(j+k<2*n){
          dp[i+1][j+k]+=dp[i][j]*C[k];
          dp[i+1][j+k]%=mod;
        }
      }
    }
  }
  cout<<dp[n][2*n-1]<<endl;
  return 0;
}
0