結果

問題 No.741 AscNumber(Easy)
ユーザー AC2KAC2K
提出日時 2023-02-06 10:17:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 3,156 bytes
コンパイル時間 3,500 ms
コンパイル使用メモリ 198,944 KB
実行使用メモリ 81,724 KB
最終ジャッジ日時 2023-09-17 22:06:49
合計ジャッジ時間 9,503 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
81,428 KB
testcase_01 AC 22 ms
81,724 KB
testcase_02 AC 22 ms
81,484 KB
testcase_03 AC 23 ms
81,428 KB
testcase_04 AC 22 ms
81,528 KB
testcase_05 AC 22 ms
81,600 KB
testcase_06 AC 22 ms
81,436 KB
testcase_07 AC 23 ms
81,596 KB
testcase_08 AC 23 ms
81,424 KB
testcase_09 AC 22 ms
81,520 KB
testcase_10 AC 22 ms
81,484 KB
testcase_11 AC 22 ms
81,632 KB
testcase_12 AC 22 ms
81,724 KB
testcase_13 AC 23 ms
81,436 KB
testcase_14 AC 23 ms
81,712 KB
testcase_15 AC 22 ms
81,708 KB
testcase_16 AC 22 ms
81,436 KB
testcase_17 AC 22 ms
81,528 KB
testcase_18 AC 22 ms
81,448 KB
testcase_19 AC 23 ms
81,572 KB
testcase_20 AC 22 ms
81,432 KB
testcase_21 AC 22 ms
81,504 KB
testcase_22 AC 23 ms
81,428 KB
testcase_23 AC 23 ms
81,424 KB
testcase_24 AC 23 ms
81,436 KB
testcase_25 AC 22 ms
81,420 KB
testcase_26 AC 23 ms
81,524 KB
testcase_27 AC 22 ms
81,524 KB
testcase_28 AC 22 ms
81,484 KB
testcase_29 AC 22 ms
81,436 KB
testcase_30 AC 22 ms
81,452 KB
testcase_31 AC 23 ms
81,432 KB
testcase_32 AC 22 ms
81,432 KB
testcase_33 AC 23 ms
81,428 KB
testcase_34 AC 22 ms
81,444 KB
testcase_35 AC 201 ms
81,704 KB
testcase_36 AC 100 ms
81,512 KB
testcase_37 AC 113 ms
81,600 KB
testcase_38 AC 114 ms
81,436 KB
testcase_39 AC 99 ms
81,420 KB
testcase_40 AC 126 ms
81,592 KB
testcase_41 AC 185 ms
81,428 KB
testcase_42 AC 109 ms
81,460 KB
testcase_43 AC 85 ms
81,436 KB
testcase_44 AC 152 ms
81,456 KB
testcase_45 AC 160 ms
81,576 KB
testcase_46 AC 193 ms
81,432 KB
testcase_47 AC 52 ms
81,484 KB
testcase_48 AC 192 ms
81,456 KB
testcase_49 AC 166 ms
81,572 KB
testcase_50 AC 42 ms
81,424 KB
testcase_51 AC 88 ms
81,448 KB
testcase_52 AC 213 ms
81,436 KB
testcase_53 AC 210 ms
81,432 KB
testcase_54 AC 214 ms
81,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i, N)  for(int i=0;i<(N);i++)
#define all(x) (x).begin(),(x).end()
#define popcount(x) __builtin_popcount(x)
using ll = long long;
//using i128=__int128_t;
using ld = long double;
using graph = vector<vector<int>>;
using P = pair<int, int>;
const int inf = 1e9;
const ll infl = 1e18;
const ld eps = 1e-6;
const long double pi = acos(-1);
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };
template<class T>inline void chmax(T&x,T y){if(x<y)x=y;}
template<class T>inline void chmin(T&x,T y){if(x>y)x=y;}
template<const ll mod>class modint {
private:
    using mint = modint<mod>;
    ll value = 0;
public:
    modint(ll v = 0) {
        v %= mod;
        if(v < 0)v += mod;
        value = v;
    }
    ll val() {
        return value % mod;
    }
    mint operator+(mint fp) {
        return mint(value + fp.val());
    }
    mint operator-(mint fp) {
        return mint(value - fp.val());
    }
    mint operator*(mint fp) {
        return mint(value * fp.val());
    }
    void operator=(mint fp) {
        value = fp.val();
    }
    void operator=(ll val) {
        value = val % mod;
        if(value < 0) {
            value += mod;
        }
    }
    void operator+=(mint fp) {
        (value += fp.val()) %= mod;
        if(value < 0) {
            value += mod;
        }
    }
    void operator-=(mint fp) {
        value = value - fp.val();
        value %= mod;
        if(value < 0) {
            value += mod;
        }
    }
    void operator*=(mint fp) {
        value = value * fp.val();
        value = value % mod;
        if(value < 0) {
            value += mod;
        }
    }
    bool operator==(mint fp) {
        return value == fp.val();
    }
    bool operator<(mint fp) {
        return value < fp.val();
    }
    bool operator>(mint fp) {
        return value > fp.val();
    }
    bool operator<=(mint fp) {
        return value <= fp.val();
    }
    bool operator>=(mint fp) {
        return value >= fp.val();
    }

    ll inv() {
        return mod_pow(mod - 2);
    }
    ll mod_pow(ll exp) {
        ll base = value;
        ll ans = 1;
        base %= mod;
        while (exp > 0) {
            if (exp & 1) {
                ans *= base;
                ans %= mod;
            }
            base *= base;
            base %= mod;
            exp >>= 1;
        }
        return ans;
    }
    mint operator/(mint a) {
        return mint(a.inv()*value);
    }
    void operator/=(mint a) {
        value = value * a.inv();
        value %= mod;
    }
    friend istream& operator>>(istream& is, mint& mt) {
        ll v;
        is >> v;
        mt = mint(v);
        return is;
    }
    friend ostream& operator << (ostream& os, mint& mt) {
        return os << mt.val();
    }
};
using mint=modint<MOD>;

mint dp[1000001][10];
int main() {
    int n;
    cin>>n;
    dp[0][0]=1;
    rep(i,n)rep(j,10){
        rep(nex,10){
            if(nex<j)continue;
            dp[i+1][nex]+=dp[i][j];
        }
    }
    mint ans=0;
    rep(i,10){
        ans+=dp[n][i];
    }
    cout<<ans<<endl;
}
0