結果

問題 No.741 AscNumber(Easy)
ユーザー suakii
提出日時 2019-05-03 12:11:03
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 597 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 1,601 ms
コンパイル使用メモリ 159,840 KB
実行使用メモリ 81,568 KB
最終ジャッジ日時 2024-12-31 15:33:10
合計ジャッジ時間 10,689 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

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

ll n, dp[1010101][10];
ll mod = 1e9 + 7;
int main() {
    ios::sync_with_stdio(false);
    cin >> n;// 1 < = 𝑁< = 1000000
    for (int i = 0; i < 10; i++)
        dp[1][i] = 1;

    for (int i = 1; i < n; i++) {
        for (int j = 0; j < 10; j++) {
            for (int next = j; next < 10; next++) {
                dp[i+1][next] += dp[i][j]%mod;

            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < 10; i++)
        ans = (ans%mod + dp[n][i]%mod)%mod;
    cout << ans << endl;
    

    return 0;
}
0