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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<iostream>
using namespace std;

long long n;
int a,b,it;
long long norm[20], spec[20] ;

int calc (int x)
{
    int wyn = 0 ;

    if (x >= 19)
        return 0 ;

    for (int i = 0; i <= x; i++)
    {
        if (x-i >= 0 && x - i <= 9 && i >= 0 && i <= 9)
            wyn++;
    }

    return wyn ;;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>> n ;;

    it = 1;
    norm [0] = 1 ;
    spec [0] = 0 ;
    while (n!=0)
    {
        a = n % 10;
        b = (n % 100) / 10 ;

        norm [it] = calc (a) * norm [it-1] + spec [it-1];

        if (b == 1)
        {
            spec [it] = calc (10 + a) * norm [it-1] ;
        }

        n= n /10 ;
        it++;
    }
    cout<<norm [it-1]<<endl;

    return 0 ;
}