結果

問題 No.1085 桁和の桁和
ユーザー yuji9511yuji9511
提出日時 2020-06-19 23:33:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 1,134 bytes
コンパイル時間 1,432 ms
コンパイル使用メモリ 163,220 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2024-04-24 10:07:49
合計ジャッジ時間 2,808 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 32 ms
11,264 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 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 2 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 10 ms
6,400 KB
testcase_15 AC 19 ms
10,496 KB
testcase_16 AC 19 ms
10,240 KB
testcase_17 AC 10 ms
6,656 KB
testcase_18 AC 6 ms
5,376 KB
testcase_19 AC 17 ms
9,600 KB
testcase_20 AC 18 ms
9,600 KB
testcase_21 AC 12 ms
7,424 KB
testcase_22 AC 15 ms
8,960 KB
testcase_23 AC 3 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 11 ms
6,912 KB
testcase_26 AC 20 ms
10,496 KB
testcase_27 AC 16 ms
8,960 KB
testcase_28 AC 23 ms
11,648 KB
testcase_29 AC 13 ms
7,808 KB
testcase_30 AC 12 ms
7,424 KB
testcase_31 AC 19 ms
10,112 KB
testcase_32 AC 13 ms
8,192 KB
testcase_33 AC 31 ms
11,520 KB
testcase_34 AC 31 ms
11,648 KB
testcase_35 AC 31 ms
11,520 KB
testcase_36 AC 32 ms
11,520 KB
testcase_37 AC 34 ms
11,520 KB
testcase_38 AC 31 ms
11,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
ll dp[100010][10] = {};

void solve(){
    string T;
    cin >> T;
    ll D;
    cin >> D;
    dp[0][0] = 1;
    ll N = T.size();
    rep(i,0,N){
        rep(j,0,10){
            if(T[i] == '?'){
                rep(k,0,10){
                    ll n = k + j;
                    if(n >= 10) n = n / 10 + n % 10;
                    (dp[i+1][n] += dp[i][j]) %= MOD;
                }
            }else{
                ll n = T[i] - '0' + j;
                if(n >= 10) n = n / 10 + n % 10;
                (dp[i+1][n] += dp[i][j]) %= MOD;
            }
        }
    }
    print(dp[N][D]);



    

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}
0