1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
using namespace std;

const int N = 100;
char s[N];
long long dp[N];

int main()
{
  dp[0] = 1;
    scanf("%s", s);
    int n=0;
    while(s[n]) n++;
    for(int i=1;i<n+1;i++) {
      long long x = s[i-1] - '0';
      dp[i] = dp[i-1] * (x+1);
      if(i != 1) {
        long long y = s[i-2] - '0';
	if(y == 0) continue;
        x = 10 * y + x;
        x -= 9;
        x = 10 - x;
        x = max(x, 0LL);
        dp[i] += dp[i-2] * x;
      }
    }
    printf("%lld", dp[n]);
}