結果

問題 No.741 AscNumber(Easy)
ユーザー Y17Y17
提出日時 2018-10-05 22:25:51
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 352 ms / 2,000 ms
コード長 422 bytes
コンパイル時間 1,445 ms
コンパイル使用メモリ 157,952 KB
実行使用メモリ 104,904 KB
最終ジャッジ日時 2024-04-20 17:20:53
合計ジャッジ時間 8,063 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
42,448 KB
testcase_01 AC 13 ms
42,368 KB
testcase_02 AC 12 ms
42,456 KB
testcase_03 AC 13 ms
42,368 KB
testcase_04 AC 13 ms
42,368 KB
testcase_05 AC 12 ms
42,220 KB
testcase_06 AC 13 ms
42,408 KB
testcase_07 AC 13 ms
42,352 KB
testcase_08 AC 12 ms
42,400 KB
testcase_09 AC 13 ms
42,496 KB
testcase_10 AC 12 ms
42,368 KB
testcase_11 AC 13 ms
42,408 KB
testcase_12 AC 13 ms
42,340 KB
testcase_13 AC 14 ms
42,496 KB
testcase_14 AC 13 ms
42,376 KB
testcase_15 AC 13 ms
42,472 KB
testcase_16 AC 12 ms
42,368 KB
testcase_17 AC 13 ms
42,368 KB
testcase_18 AC 13 ms
42,584 KB
testcase_19 AC 13 ms
42,496 KB
testcase_20 AC 14 ms
42,496 KB
testcase_21 AC 13 ms
42,368 KB
testcase_22 AC 13 ms
42,436 KB
testcase_23 AC 12 ms
42,496 KB
testcase_24 AC 13 ms
42,496 KB
testcase_25 AC 13 ms
42,492 KB
testcase_26 AC 13 ms
42,420 KB
testcase_27 AC 13 ms
42,496 KB
testcase_28 AC 13 ms
42,444 KB
testcase_29 AC 13 ms
42,368 KB
testcase_30 AC 13 ms
42,616 KB
testcase_31 AC 13 ms
42,496 KB
testcase_32 AC 13 ms
42,368 KB
testcase_33 AC 14 ms
42,548 KB
testcase_34 AC 13 ms
42,552 KB
testcase_35 AC 326 ms
102,052 KB
testcase_36 AC 155 ms
68,292 KB
testcase_37 AC 177 ms
72,908 KB
testcase_38 AC 176 ms
72,576 KB
testcase_39 AC 150 ms
67,688 KB
testcase_40 AC 202 ms
77,056 KB
testcase_41 AC 302 ms
96,880 KB
testcase_42 AC 166 ms
71,168 KB
testcase_43 AC 125 ms
63,292 KB
testcase_44 AC 241 ms
85,120 KB
testcase_45 AC 261 ms
88,232 KB
testcase_46 AC 319 ms
99,132 KB
testcase_47 AC 66 ms
52,084 KB
testcase_48 AC 318 ms
99,040 KB
testcase_49 AC 274 ms
89,856 KB
testcase_50 AC 47 ms
48,768 KB
testcase_51 AC 132 ms
64,336 KB
testcase_52 AC 345 ms
104,904 KB
testcase_53 AC 348 ms
104,864 KB
testcase_54 AC 352 ms
104,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000007

int n;
int memo[1000010][10];

int dfs(int i, int j){
  if(i == n){
    return 1;
  }

  if(memo[i][j] != -1) return memo[i][j];

  long long ans = 0;
  for(int k = j;k <= 9;k++){
    ans = (ans + dfs(i+1,k)) % MOD;
  }

  return memo[i][j] = ans;
}


int main(){
  cin >> n;
  memset(memo,-1,sizeof(memo));
  cout << dfs(0, 0) << endl;
  return 0;
}
0