結果

問題 No.741 AscNumber(Easy)
ユーザー sten_sansten_san
提出日時 2021-01-31 16:37:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 50 ms / 2,000 ms
コード長 916 bytes
コンパイル時間 2,459 ms
コンパイル使用メモリ 200,816 KB
実行使用メモリ 81,156 KB
最終ジャッジ日時 2023-09-11 10:40:23
合計ジャッジ時間 5,540 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 2 ms
4,384 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,384 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 48 ms
77,532 KB
testcase_36 AC 21 ms
35,540 KB
testcase_37 AC 25 ms
41,100 KB
testcase_38 AC 25 ms
40,572 KB
testcase_39 AC 23 ms
34,872 KB
testcase_40 AC 29 ms
46,344 KB
testcase_41 AC 44 ms
71,140 KB
testcase_42 AC 24 ms
39,160 KB
testcase_43 AC 19 ms
28,904 KB
testcase_44 AC 36 ms
56,248 KB
testcase_45 AC 37 ms
60,632 KB
testcase_46 AC 46 ms
73,924 KB
testcase_47 AC 10 ms
15,392 KB
testcase_48 AC 45 ms
73,856 KB
testcase_49 AC 38 ms
62,084 KB
testcase_50 AC 7 ms
10,968 KB
testcase_51 AC 20 ms
30,512 KB
testcase_52 AC 50 ms
81,156 KB
testcase_53 AC 50 ms
81,152 KB
testcase_54 AC 50 ms
80,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

struct uns_t {} uns;
template <typename Element, typename Head, typename ...Args>
auto vec(Element init, Head arg, Args ...args) {
    if constexpr (sizeof...(Args) == 0) return std::vector(arg, init);
    else return std::vector(arg, vec(init, args...));
}
template <typename Element, typename Head, typename ...Args>
auto vec(uns_t, Head arg, Args ...args) {
    return vec(Element(), arg, args...);
}

int main() {
    constexpr int64_t mod = 1e9 + 7;

    int n; cin >> n;

    auto dp = vec<array<int64_t, 10>>(uns, n + 1);
    dp[0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        int64_t sum = 0;
        for (int j = 0; j <= 9; ++j) {
            sum += dp[i - 1][j];
            sum %= mod;
            dp[i][j] = sum;
        }
    }

    int64_t ans = 0;
    for (auto e : dp[n]) {
        ans += e;
        ans %= mod;
    }

    cout << ans << endl;
}

0