結果

問題 No.741 AscNumber(Easy)
ユーザー 👑 Kazun
提出日時 2021-02-19 04:23:41
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 458 bytes
コンパイル時間 935 ms
コンパイル使用メモリ 77,208 KB
実行使用メモリ 278,304 KB
最終ジャッジ日時 2024-09-15 08:25:32
合計ジャッジ時間 5,132 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35 TLE * 1 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>

using namespace std;

using ll=long long;

ll mod=1e9+7;
map<pair<int,int>,ll> Memo;

ll f(int x,int n){
    if (n==1) return 1;
    if (Memo.count(make_pair(x,n))==1) return Memo[make_pair(x,n)];

    ll A=0;
    for (int i=0;i<=x;i++) A+=f(i,n-1);
    A%=mod;
    
    return Memo[make_pair(x,n)]=A;
}
int main(){
    int N;
    cin >> N;
    
    ll X=0;
    for (int i=0;i<=9;i++) X+=f(i,N);
    cout << X%mod << endl;
}
0