結果

問題 No.741 AscNumber(Easy)
ユーザー daleksprinterdaleksprinter
提出日時 2018-10-08 00:38:39
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 395 ms / 2,000 ms
コード長 2,073 bytes
コンパイル時間 1,634 ms
コンパイル使用メモリ 163,068 KB
実行使用メモリ 159,860 KB
最終ジャッジ日時 2024-04-20 18:24:45
合計ジャッジ時間 10,215 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
81,664 KB
testcase_01 AC 57 ms
81,716 KB
testcase_02 AC 57 ms
81,536 KB
testcase_03 AC 57 ms
81,540 KB
testcase_04 AC 58 ms
81,720 KB
testcase_05 AC 58 ms
81,624 KB
testcase_06 AC 57 ms
81,792 KB
testcase_07 AC 58 ms
81,648 KB
testcase_08 AC 58 ms
81,792 KB
testcase_09 AC 57 ms
81,664 KB
testcase_10 AC 55 ms
81,552 KB
testcase_11 AC 57 ms
81,724 KB
testcase_12 AC 56 ms
81,584 KB
testcase_13 AC 57 ms
81,664 KB
testcase_14 AC 57 ms
81,504 KB
testcase_15 AC 57 ms
81,536 KB
testcase_16 AC 57 ms
81,660 KB
testcase_17 AC 58 ms
81,572 KB
testcase_18 AC 58 ms
81,716 KB
testcase_19 AC 57 ms
81,748 KB
testcase_20 AC 56 ms
81,664 KB
testcase_21 AC 57 ms
81,588 KB
testcase_22 AC 58 ms
81,748 KB
testcase_23 AC 58 ms
81,664 KB
testcase_24 AC 56 ms
81,664 KB
testcase_25 AC 58 ms
81,664 KB
testcase_26 AC 58 ms
81,632 KB
testcase_27 AC 59 ms
81,792 KB
testcase_28 AC 57 ms
81,764 KB
testcase_29 AC 58 ms
81,692 KB
testcase_30 AC 61 ms
81,772 KB
testcase_31 AC 58 ms
81,592 KB
testcase_32 AC 58 ms
81,712 KB
testcase_33 AC 57 ms
81,792 KB
testcase_34 AC 57 ms
81,736 KB
testcase_35 AC 372 ms
156,160 KB
testcase_36 AC 204 ms
114,244 KB
testcase_37 AC 223 ms
119,936 KB
testcase_38 AC 215 ms
119,296 KB
testcase_39 AC 195 ms
113,404 KB
testcase_40 AC 247 ms
124,760 KB
testcase_41 AC 354 ms
149,524 KB
testcase_42 AC 212 ms
117,504 KB
testcase_43 AC 172 ms
107,776 KB
testcase_44 AC 298 ms
134,668 KB
testcase_45 AC 306 ms
138,932 KB
testcase_46 AC 357 ms
152,428 KB
testcase_47 AC 111 ms
93,564 KB
testcase_48 AC 365 ms
152,564 KB
testcase_49 AC 309 ms
140,744 KB
testcase_50 AC 90 ms
89,728 KB
testcase_51 AC 175 ms
109,008 KB
testcase_52 AC 395 ms
159,860 KB
testcase_53 AC 380 ms
159,616 KB
testcase_54 AC 387 ms
159,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


/* macro */
#define rep(i,a,b) for(int i=a;i<b;i++)
#define revrep(i,a,b) for(int i = a; i > b; i--)
#define int long long
#define exist(s,e) ((s).find(e)!=(s).end())
#define all(v) (v).begin(), (v).end()
#define each(s,itr) for(auto (itr) = s.begin(); (itr) != s.end(); (itr)++)
#define sum(v) accumulate(all(v), (0LL))
#define sort(v) sort(all(v))



/* constant */
const int inf = 100100100100100100;
const int mod = 1000000007;
int dx[8]={1,0,-1,0,-1,1,-1,1};
int dy[8]={0,1,0,-1,-1,-1,1,1};


/* io_method */
int input(){int tmp;cin >> tmp;return tmp;}
string raw_input(){string tmp;cin >> tmp;return tmp;}
string readline(){string s;getline(cin, s);return s;}
template<class T> void printx(T n){cout << n;}
template<class T, class U> void printx(pair<T, U> p){cout << "(" << p.first << "," << p.second << ")";}
template<class T> void printx(vector<T> v){cout << "{";rep(i,0,v.size()){printx(v[i]);if(i != v.size()-1)printx(",");}cout << "}";}
template<class T> void print(T n){printx(n);cout << endl;}
template<class T> void print(set<T> s){cout << "{";each(s, e){if(e != s.begin()) printx(",");printx(*e);}cout << "}" << endl;}
template<class T, class U> void print(map<T, U> mp){cout << "{";each(mp, e){cout << "(" << e -> first << "," << e -> second << ")";}cout << "}" << endl;}


/* general_method */
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }


/* math_library */
int ceil(int a, int b){if(a % b == 0){return a/b;}else{return a/b + 1;}}


/* main */


int dp[1000010][10];
int n;

int dfs(int digit,int p){

    if(dp[digit][p] > -1) return dp[digit][p];

    if(digit == n) return 1;

    int ans = 0;
    for(int i = p; i <= 9; i++){
        ans += dfs(digit + 1, i) % mod;
    }

    return dp[digit][p] = ans % mod;
    

}

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    memset(dp, -1, sizeof(dp));

    n = input();

    print(dfs(0, 0));








}   
0