O-nepal
Find number of different palindromic numbers, odd length K, written in base B possible to made from matrix NxN of digits. You can made numbers starting from any digit from matrix and then adding any of eight neighbors until reach length K.
InputIn first line of input are three integers N,K i B, (1 <= N <= 10), (1 <= K <= 13), (2 <= B <=10).
Digit is integer from 0 to 9.
Digit is integer from 0 to 9.
OutputIn first line of output write number of different palindromic numbers, odd length K, written in base B, using given matrix.
NOTICE:
20% : N,K,B < 4
40% : N,K,B < 6
60% : N,K,B < 8
80% : N,K,B < 10
Input:
5 3 4
11111
11111
10211
13117
11154
Output:
10
[p]Explanation: possible palindromic numbers of length 3, written in base 4 are: 111, 101, 121, 131, 202, 212, 232, 303, 313 i 323.
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.