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
#include <iostream>
#include <cmath>
void find_solutions(int n, int n_length, int n_part, int& result)
{
	if (n_part < n_length)
	{
		for (int A = 0; A < 10; A++)
			for (int B = 0; B < 10; B++)
				if (n % 10 == (A + B) % 10)
				{
					if (A + B < 10)
						find_solutions((n - n % 10) / 10, n_length, n_part + 1, result);
					else
					{
						if (n_part + 1 == n_length && n % 100 == A + B)
							result++;
						else if ((n_part + 1 < n_length) && (n % 100 == A + B))
							find_solutions((n - n % 100) / 100, n_length, n_part + 2, result);
					}
				}
	}
	else if(n_part==n_length)
		for (int A = 0; A < 10; A++)
			for (int B = 0; B < 10; B++)
				if (n == (A + B))
					result++;
}
int main()
{
	int n;
	std::cin >> n;
	int n_length=1;
	while (n / pow(10,n_length) >1)
		n_length++;
	int n_part = 1;
	int result = 0;
	find_solutions(n,n_length,n_part,result);
	std::cout << result << std::endl;
	return 0;
}