結果

問題 No.741 AscNumber(Easy)
ユーザー simansiman
提出日時 2021-12-15 06:01:47
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 708 bytes
コンパイル時間 5,827 ms
コンパイル使用メモリ 106,132 KB
実行使用メモリ 81,704 KB
最終ジャッジ日時 2023-10-01 02:25:29
合計ジャッジ時間 10,495 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
81,704 KB
testcase_01 AC 27 ms
81,628 KB
testcase_02 AC 29 ms
81,600 KB
testcase_03 AC 30 ms
81,596 KB
testcase_04 AC 29 ms
81,656 KB
testcase_05 AC 29 ms
81,528 KB
testcase_06 AC 27 ms
81,616 KB
testcase_07 AC 28 ms
81,604 KB
testcase_08 AC 28 ms
81,624 KB
testcase_09 AC 26 ms
81,596 KB
testcase_10 AC 27 ms
81,584 KB
testcase_11 AC 27 ms
81,588 KB
testcase_12 AC 25 ms
81,628 KB
testcase_13 AC 25 ms
81,536 KB
testcase_14 AC 26 ms
81,588 KB
testcase_15 AC 23 ms
81,592 KB
testcase_16 AC 24 ms
81,664 KB
testcase_17 AC 23 ms
81,616 KB
testcase_18 AC 23 ms
81,584 KB
testcase_19 AC 24 ms
81,588 KB
testcase_20 AC 24 ms
81,592 KB
testcase_21 AC 24 ms
81,536 KB
testcase_22 AC 23 ms
81,656 KB
testcase_23 AC 24 ms
81,588 KB
testcase_24 AC 30 ms
81,608 KB
testcase_25 AC 28 ms
81,592 KB
testcase_26 AC 25 ms
81,608 KB
testcase_27 AC 23 ms
81,680 KB
testcase_28 AC 22 ms
81,560 KB
testcase_29 AC 23 ms
81,668 KB
testcase_30 AC 24 ms
81,668 KB
testcase_31 AC 24 ms
81,672 KB
testcase_32 AC 24 ms
81,600 KB
testcase_33 AC 24 ms
81,524 KB
testcase_34 AC 24 ms
81,668 KB
testcase_35 AC 157 ms
81,536 KB
testcase_36 AC 82 ms
81,632 KB
testcase_37 AC 93 ms
81,668 KB
testcase_38 AC 93 ms
81,660 KB
testcase_39 AC 84 ms
81,592 KB
testcase_40 AC 101 ms
81,668 KB
testcase_41 AC 149 ms
81,624 KB
testcase_42 AC 90 ms
81,584 KB
testcase_43 AC 71 ms
81,664 KB
testcase_44 AC 123 ms
81,532 KB
testcase_45 AC 125 ms
81,592 KB
testcase_46 AC 153 ms
81,540 KB
testcase_47 AC 45 ms
81,592 KB
testcase_48 AC 147 ms
81,604 KB
testcase_49 AC 126 ms
81,584 KB
testcase_50 AC 36 ms
81,528 KB
testcase_51 AC 71 ms
81,636 KB
testcase_52 AC 162 ms
81,584 KB
testcase_53 AC 161 ms
81,668 KB
testcase_54 AC 161 ms
81,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
ll dp[1000010][10];

int main() {
  int N;
  cin >> N;
  memset(dp, 0, sizeof(dp));

  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j <= 9; ++j) {
      if (j != 0 || i == N) dp[i][j]++;

      for (int k = 1; k <= j; ++k) {
        dp[i][j] += dp[i - 1][k];
        dp[i][j] %= MOD;
      }
    }
  }

  ll ans = 0;

  for (int i = 0; i <= 9; ++i) {
    ans += dp[N][i];
    ans %= MOD;
  }

  cout << ans << endl;

  return 0;
}
0