結果

問題 No.741 AscNumber(Easy)
ユーザー firiexpfiriexp
提出日時 2018-10-05 21:39:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 1,255 bytes
コンパイル時間 799 ms
コンパイル使用メモリ 87,348 KB
実行使用メモリ 73,564 KB
最終ジャッジ日時 2024-04-27 15:38:28
合計ジャッジ時間 4,422 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 1 ms
6,944 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 AC 1 ms
6,940 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 1 ms
6,944 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 1 ms
6,940 KB
testcase_32 AC 2 ms
6,940 KB
testcase_33 AC 2 ms
6,944 KB
testcase_34 AC 2 ms
6,940 KB
testcase_35 AC 186 ms
70,356 KB
testcase_36 AC 79 ms
32,428 KB
testcase_37 AC 93 ms
37,676 KB
testcase_38 AC 97 ms
37,040 KB
testcase_39 AC 82 ms
31,800 KB
testcase_40 AC 105 ms
42,152 KB
testcase_41 AC 168 ms
64,464 KB
testcase_42 AC 91 ms
35,688 KB
testcase_43 AC 67 ms
26,632 KB
testcase_44 AC 129 ms
51,060 KB
testcase_45 AC 140 ms
54,944 KB
testcase_46 AC 176 ms
66,996 KB
testcase_47 AC 31 ms
14,100 KB
testcase_48 AC 169 ms
66,940 KB
testcase_49 AC 139 ms
56,560 KB
testcase_50 AC 22 ms
10,496 KB
testcase_51 AC 68 ms
27,972 KB
testcase_52 AC 195 ms
73,564 KB
testcase_53 AC 190 ms
73,512 KB
testcase_54 AC 193 ms
72,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <limits>
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

template <class T, size_t D> struct _Vec {
    using type = vector<typename _Vec<T, D-1>::type>;
};
template <class T> struct _Vec<T, 1> {
    using type = vector<T>;
};
template<class T, size_t D> using Vec = typename _Vec<T, D>::type;

template <class T>
vector<T> make_v(size_t size, const T& init){ return vector<T>(size, init); }

template<class... Ts>
auto make_v(size_t size, Ts... rest) {
    return vector<decltype(make_v(rest...))>(size, make_v(rest...));
}
int main() {
    int n;
    cin >> n;
    Vec<int, 2> v = make_v(n, 10, 0);
    for (int i = 0; i < 10; ++i) {
        v[0][i] = 1;
    }
    for (int i = 1; i < n; ++i) {
        for (int j = 0; j < 10; ++j) {
            for (int k = 0; k <= j; ++k) {
                v[i][j] = (v[i][j] + v[i-1][k]) % MOD;
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < 10; ++i) {
        ans = (ans + v[n-1][i]) % MOD;
    }
    cout << ans << "\n";
    return 0;
}
0