結果

問題 No.1964 sum = length
ユーザー monnumonnu
提出日時 2022-06-03 21:34:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 453 ms / 2,000 ms
コード長 715 bytes
コンパイル時間 3,977 ms
コンパイル使用メモリ 231,748 KB
実行使用メモリ 4,364 KB
最終ジャッジ日時 2023-10-21 01:40:04
合計ジャッジ時間 13,823 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 38 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 4 ms
4,348 KB
testcase_05 AC 6 ms
4,348 KB
testcase_06 AC 9 ms
4,348 KB
testcase_07 AC 12 ms
4,348 KB
testcase_08 AC 13 ms
4,348 KB
testcase_09 AC 16 ms
4,348 KB
testcase_10 AC 18 ms
4,348 KB
testcase_11 AC 20 ms
4,348 KB
testcase_12 AC 94 ms
4,348 KB
testcase_13 AC 137 ms
4,348 KB
testcase_14 AC 187 ms
4,348 KB
testcase_15 AC 211 ms
4,348 KB
testcase_16 AC 36 ms
4,348 KB
testcase_17 AC 108 ms
4,348 KB
testcase_18 AC 122 ms
4,348 KB
testcase_19 AC 78 ms
4,348 KB
testcase_20 AC 86 ms
4,348 KB
testcase_21 AC 34 ms
4,348 KB
testcase_22 AC 412 ms
4,348 KB
testcase_23 AC 403 ms
4,348 KB
testcase_24 AC 295 ms
4,348 KB
testcase_25 AC 322 ms
4,348 KB
testcase_26 AC 429 ms
4,348 KB
testcase_27 AC 361 ms
4,348 KB
testcase_28 AC 315 ms
4,348 KB
testcase_29 AC 383 ms
4,348 KB
testcase_30 AC 325 ms
4,348 KB
testcase_31 AC 429 ms
4,348 KB
testcase_32 AC 235 ms
4,348 KB
testcase_33 AC 228 ms
4,348 KB
testcase_34 AC 401 ms
4,348 KB
testcase_35 AC 264 ms
4,348 KB
testcase_36 AC 338 ms
4,348 KB
testcase_37 AC 379 ms
4,348 KB
testcase_38 AC 442 ms
4,364 KB
testcase_39 AC 318 ms
4,348 KB
testcase_40 AC 326 ms
4,348 KB
testcase_41 AC 416 ms
4,348 KB
testcase_42 AC 453 ms
4,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define INF 1000000000000000000
#define MOD 998244353
#define MAX 1000000

int main(){
  int n;
  cin>>n;

  int M=300;
  vector<vector<ll>> dp(n,vector<ll>(2*M+1,0));
  for(int num=1;num<=M;num++){
    int j=num-to_string(num).size()+M;
    if(0<=j&&j<=2*M){
      dp[0][j]++;
    }
  }
  for(int i=1;i<n;i++){
    for(int j=0;j<=2*M;j++){
      for(int num=1;num<=M;num++){
        int nj=j+(num-to_string(num).size()-1);
        if(0<=nj&&nj<=2*M){
          dp[i][nj]+=dp[i-1][j];
          dp[i][nj]%=MOD;
        }
      }
    }
  }

  cout<<dp[n-1][M]<<'\n';
}
0