結果

問題 No.741 AscNumber(Easy)
ユーザー cotton_fn_cotton_fn_
提出日時 2019-08-09 21:20:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 1,297 bytes
コンパイル時間 1,227 ms
コンパイル使用メモリ 113,888 KB
実行使用メモリ 81,140 KB
最終ジャッジ日時 2023-09-26 16:46:38
合計ジャッジ時間 4,647 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,384 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,384 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 61 ms
77,472 KB
testcase_36 AC 28 ms
35,480 KB
testcase_37 AC 33 ms
41,224 KB
testcase_38 AC 31 ms
40,744 KB
testcase_39 AC 27 ms
34,856 KB
testcase_40 AC 36 ms
46,284 KB
testcase_41 AC 56 ms
71,188 KB
testcase_42 AC 32 ms
38,860 KB
testcase_43 AC 24 ms
28,960 KB
testcase_44 AC 44 ms
56,364 KB
testcase_45 AC 47 ms
60,276 KB
testcase_46 AC 58 ms
73,812 KB
testcase_47 AC 12 ms
14,904 KB
testcase_48 AC 58 ms
73,848 KB
testcase_49 AC 49 ms
62,112 KB
testcase_50 AC 9 ms
10,976 KB
testcase_51 AC 24 ms
30,512 KB
testcase_52 AC 64 ms
81,140 KB
testcase_53 AC 64 ms
81,072 KB
testcase_54 AC 64 ms
80,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

const i64 mod = 1e9 + 7;
i64 n;
vector<array<i64, 10>> dp;
int main() {
  cin >> n;
  init_n(dp, n + 1);
  dp[0][0] = 1;
  for (i64 i = 1; i <= n; ++i) {
    for (i64 j = 0; j <= 9; ++j) {
      for (i64 k = 0; k <= j; ++k) {
        dp[i][j] += dp[i - 1][k];
      }
      dp[i][j] %= mod;
    }
  }
  i64 ans = 0;
  for (i64 i = 0; i <= 9; ++i) ans += dp[n][i];
  ans %= mod;
  cout << ans << endl;
  return 0;
}
0