結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-09-05 20:06:36
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 6 ms / 3,000 ms
コード長 1,251 bytes
コンパイル時間 5,406 ms
コンパイル使用メモリ 311,996 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 20:06:44
合計ジャッジ時間 6,903 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 4 ms
4,380 KB
testcase_34 AC 6 ms
4,380 KB
testcase_35 AC 5 ms
4,380 KB
testcase_36 AC 5 ms
4,376 KB
testcase_37 AC 5 ms
4,376 KB
testcase_38 AC 5 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint1000000007;
using ll=long long;
using pp=pair<ll,ll>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
  sr s;cin>>s;
  vc dp(3,vc<mint>(3,0)); int ta=0,tb=0;bool ok=true,fir=true;
  for(char c:s){
    int x=c-'0';
    vc pre(3,vc<mint>(3,0)); swap(pre,dp);
    if(x==0)ok=false;
   
    if(!fir){
      dp[0][0]+=4;
      dp[1][0]+=2; dp[0][1]++;
      dp[2][0]+=2;
    }
    if(ok)for(int i=1;i<x;i++){
      int a=ta,b=tb;
      if(i==2||i==6)a++; if(i==5)b++; if(i==4||i==8)a+=2;
      a=min(a,2); b=min(b,2);
      dp[a][b]++;
    }
    rep(i,3)rep(j,3){
      for(int t=1;t<10;t++){
        int ni=i,nj=j;
        if(t==2||t==6)ni++; if(t==5)nj++; if(t==4||t==8)ni+=2;
        ni=min(ni,2); nj=min(nj,2);
        dp[ni][nj]+=pre[i][j];
      }
    }
    fir=false;
    if(x==2||x==6)ta++; if(x==5)tb++; if(x==4||x==8)ta+=2;
    ta=min(ta,2); tb=min(tb,2);
  }
  mint ans=dp[2][2];
  if(ta==2&&tb==2&&ok)ans++;
  cout<<ans.val();
}
      
  
0