結果

問題 No.741 AscNumber(Easy)
ユーザー Gosu_HirooGosu_Hiroo
提出日時 2018-10-06 11:23:24
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 198 ms / 2,000 ms
コード長 1,617 bytes
コンパイル時間 1,302 ms
コンパイル使用メモリ 157,744 KB
実行使用メモリ 89,344 KB
最終ジャッジ日時 2024-04-20 17:47:39
合計ジャッジ時間 5,098 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 195 ms
85,120 KB
testcase_36 AC 84 ms
39,168 KB
testcase_37 AC 98 ms
45,568 KB
testcase_38 AC 93 ms
44,800 KB
testcase_39 AC 82 ms
38,400 KB
testcase_40 AC 111 ms
50,944 KB
testcase_41 AC 169 ms
78,080 KB
testcase_42 AC 92 ms
42,880 KB
testcase_43 AC 71 ms
31,872 KB
testcase_44 AC 139 ms
61,696 KB
testcase_45 AC 148 ms
66,432 KB
testcase_46 AC 180 ms
81,280 KB
testcase_47 AC 32 ms
16,512 KB
testcase_48 AC 180 ms
81,152 KB
testcase_49 AC 172 ms
68,480 KB
testcase_50 AC 23 ms
12,160 KB
testcase_51 AC 71 ms
33,536 KB
testcase_52 AC 198 ms
89,216 KB
testcase_53 AC 197 ms
89,344 KB
testcase_54 AC 198 ms
88,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define tr(container, it) \
        for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c, x) ((c).find(x) != (c).end())   //O(log n)
#define contains(c, x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define ill(_x)  ll _x;scanf("%lld",&_x);
#define idb(_x)  double _x;scanf("%lf",&_x);
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define sll set<ll>
#define vs vector<string>
#define in0(x, a, b)((x)>=a && (x)<=b    )
#define in1(x, a, b)((x)>a && (x)<b)
#define  rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define gcd __gcd

const double pi = 3.14159265358979323846;


const int INF = 0x3f3f3f3f;
const int MOD = (int)(1e9+7);


ll dp[1000002][11];
void _(){
    int n;
    cin >> n;
    for (int i = 0; i < 10; ++i) {
        dp[0][i] = 1;
    }
    for (int i = 1; i < n+3; ++i) {
        for (int j = 1; j < 10; ++j) {
            for (int k = 1; k <=j; ++k) {
                dp[i][j] += dp[i-1][k];
                dp[i][j] %= MOD;
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < n + 1; ++i) {
        ans += dp[i][9];
        ans %= MOD;
    }
    cout << ans;
}


int main() {
#ifdef Debug
    freopen("/home/joduskame/Desktop/cpp/IO/Input.txt", "r", stdin);
    freopen("/home/joduskame/Desktop/cpp/IO/Output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    _();
    return 0;

}



0