結果

問題 No.741 AscNumber(Easy)
ユーザー peroonperoon
提出日時 2019-04-25 06:58:50
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 934 bytes
コンパイル時間 1,633 ms
コンパイル使用メモリ 166,292 KB
実行使用メモリ 81,664 KB
最終ジャッジ日時 2024-04-28 17:17:57
合計ジャッジ時間 5,307 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 2 ms
6,944 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 170 ms
77,824 KB
testcase_36 AC 75 ms
35,840 KB
testcase_37 AC 88 ms
41,728 KB
testcase_38 AC 87 ms
41,088 KB
testcase_39 AC 74 ms
35,328 KB
testcase_40 AC 100 ms
46,592 KB
testcase_41 AC 155 ms
71,296 KB
testcase_42 AC 83 ms
39,424 KB
testcase_43 AC 60 ms
29,312 KB
testcase_44 AC 121 ms
56,704 KB
testcase_45 AC 130 ms
60,800 KB
testcase_46 AC 162 ms
74,240 KB
testcase_47 AC 29 ms
15,360 KB
testcase_48 AC 162 ms
74,368 KB
testcase_49 AC 134 ms
62,720 KB
testcase_50 AC 20 ms
11,520 KB
testcase_51 AC 62 ms
30,720 KB
testcase_52 AC 178 ms
81,536 KB
testcase_53 AC 181 ms
81,664 KB
testcase_54 AC 179 ms
80,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

// dp[i][j]
// i 桁まで確定
// j 最下位桁の値 (leftmost)
ll dp[1000010][10];

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    // input
    ll N;
    cin >> N;

    FOR(i, 0, 10){
        dp[1][i] = 1;
    }

    FOR(i, 1, N){
        FOR(lst, 0, 10){
            FOR(nxt, lst, 10){
                dp[i+1][nxt] += dp[i][lst];
                dp[i+1][nxt] %= mod;
            }
        }
    }

    ll sum = 0;
    FOR(i, 0, 10){
        sum += dp[N][i];
        sum %= mod;
    }

    p(sum);
    
    return 0;
}
0