結果

問題 No.741 AscNumber(Easy)
ユーザー kuc_jacksonkuc_jackson
提出日時 2021-05-06 12:03:27
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 924 ms / 2,000 ms
コード長 590 bytes
コンパイル時間 2,224 ms
コンパイル使用メモリ 204,780 KB
実行使用メモリ 276,496 KB
最終ジャッジ日時 2023-10-12 05:04:29
合計ジャッジ時間 15,877 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,352 KB
testcase_18 AC 1 ms
4,352 KB
testcase_19 AC 1 ms
4,352 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 3 ms
4,352 KB
testcase_23 AC 3 ms
4,348 KB
testcase_24 AC 1 ms
4,352 KB
testcase_25 AC 2 ms
4,352 KB
testcase_26 AC 2 ms
4,352 KB
testcase_27 AC 1 ms
4,352 KB
testcase_28 AC 1 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 1 ms
4,348 KB
testcase_33 AC 2 ms
4,352 KB
testcase_34 AC 2 ms
4,348 KB
testcase_35 AC 887 ms
263,664 KB
testcase_36 AC 379 ms
116,564 KB
testcase_37 AC 449 ms
136,492 KB
testcase_38 AC 442 ms
134,716 KB
testcase_39 AC 375 ms
114,292 KB
testcase_40 AC 505 ms
154,464 KB
testcase_41 AC 793 ms
240,868 KB
testcase_42 AC 425 ms
128,940 KB
testcase_43 AC 307 ms
93,904 KB
testcase_44 AC 622 ms
189,096 KB
testcase_45 AC 672 ms
203,608 KB
testcase_46 AC 828 ms
250,848 KB
testcase_47 AC 140 ms
44,876 KB
testcase_48 AC 826 ms
251,096 KB
testcase_49 AC 688 ms
210,168 KB
testcase_50 AC 95 ms
30,964 KB
testcase_51 AC 322 ms
98,552 KB
testcase_52 AC 905 ms
276,272 KB
testcase_53 AC 924 ms
276,496 KB
testcase_54 AC 912 ms
273,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ll mod = 1000000007;

int main(){
    ll N; cin >> N;
    vector<vector<vector<ll>>> dp(N + 2, vector<vector<ll>>(2, vector<ll>(10, 0)));
    dp[1][1][0] = 1; dp[1][0][1] = 1;
    for(int i = 1; i <= N; i++){
        for(int j = 0; j <= 9; j++)for(int k = j; k <= 9; k++){
            dp[i + 1][1][k] = (dp[i + 1][1][k] + dp[i][1][j]) % mod;
            if(k == 0)dp[i + 1][0][k] += dp[i][0][j];
        }
    }
    ll cnt = 0;
    for(int i = 0; i <= 9; i++)cnt = (cnt + dp[N + 1][1][i]) % mod;
    cout << cnt << endl;
}
0