結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー 👑 NachiaNachia
提出日時 2021-03-05 22:43:14
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 53 ms / 3,000 ms
コード長 842 bytes
コンパイル時間 5,526 ms
コンパイル使用メモリ 254,420 KB
実行使用メモリ 15,616 KB
最終ジャッジ日時 2024-04-16 10:29:13
合計ジャッジ時間 6,225 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
15,488 KB
testcase_01 AC 10 ms
15,360 KB
testcase_02 AC 10 ms
15,616 KB
testcase_03 AC 10 ms
15,616 KB
testcase_04 AC 10 ms
15,360 KB
testcase_05 AC 11 ms
15,488 KB
testcase_06 AC 11 ms
15,360 KB
testcase_07 AC 10 ms
15,616 KB
testcase_08 AC 10 ms
15,488 KB
testcase_09 AC 10 ms
15,488 KB
testcase_10 AC 10 ms
15,488 KB
testcase_11 AC 10 ms
15,360 KB
testcase_12 AC 11 ms
15,360 KB
testcase_13 AC 11 ms
15,488 KB
testcase_14 AC 10 ms
15,360 KB
testcase_15 AC 11 ms
15,488 KB
testcase_16 AC 11 ms
15,360 KB
testcase_17 AC 11 ms
15,488 KB
testcase_18 AC 10 ms
15,616 KB
testcase_19 AC 11 ms
15,488 KB
testcase_20 AC 11 ms
15,360 KB
testcase_21 AC 10 ms
15,488 KB
testcase_22 AC 11 ms
15,360 KB
testcase_23 AC 11 ms
15,360 KB
testcase_24 AC 11 ms
15,616 KB
testcase_25 AC 11 ms
15,488 KB
testcase_26 AC 11 ms
15,616 KB
testcase_27 AC 11 ms
15,488 KB
testcase_28 AC 11 ms
15,616 KB
testcase_29 AC 11 ms
15,360 KB
testcase_30 AC 14 ms
15,488 KB
testcase_31 AC 13 ms
15,488 KB
testcase_32 AC 17 ms
15,360 KB
testcase_33 AC 25 ms
15,616 KB
testcase_34 AC 43 ms
15,488 KB
testcase_35 AC 44 ms
15,360 KB
testcase_36 AC 45 ms
15,360 KB
testcase_37 AC 53 ms
15,488 KB
testcase_38 AC 34 ms
15,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

using mll=atcoder::static_modint<1000000007>;

string N;
mll dp1[10002][100];
mll dp[10002][100];
mll dpf[10002][100];

int main(){
  cin>>N;
  int n=N.size();
  rep(i,n+1) rep(j,100) dp1[i][j]=dp[i][j]=dpf[i][j]=0;

  mll ans=0;

  dp1[0][1]=1;
  rep(i,n-1){
    for(int x=1; x<=9; x++) rep(t,100) dp1[i+1][t*x%100]+=dp1[i][t];
    ans+=dp1[i+1][0];
  }

  dpf[0][1]=1;
  rep(i,n){
    int d=N[n-1-i]-'0';
    if(d!=0) rep(t,100) dp[i+1][t*d%100]+=dp[i][t];
    for(int x=1; x<d; x++) rep(t,100) dp[i+1][t*x%100]+=dp1[i][t];
  }
  ans+=dp[n][0];

  int t=1; for(char c:N){ if(c=='0'){ t=1; break; } t=t*(c-'0')%100; }
  if(t==0) ans++;

  printf("%u\n",ans.val());
  return 0;
}
0