#P6871. [COCI 2013/2014 #6] HASH
[COCI 2013/2014 #6] HASH
Background
Mirko is studying a hash function.
Problem Description
This hash function is defined as follows:
- $f(a_i+s_i)=((f(s_i)\times33)\operatorname{xor}\ \operatorname{ord}(a_i))\bmod MOD$
Here, represents a character and represents a string. Both consist of lowercase letters.
- denotes the bitwise XOR operator.
- denotes the position of the letter in the alphabet (for example, and ).
is an integer of the form .
When , some values of the hash function are:
How many words have hash value and length ?
Input Format
One line containing three integers , , and .
Output Format
Output one line containing the number of words of length whose hash value is .
1 0 10
0
1 2 10
1
3 16 10
4
Hint
Sample Explanation
Sample 1 Explanation
All characters in the alphabet have values that are not .
Sample 2 Explanation
The word is b.
Sample 3 Explanation
The words are dxl, hph, lxd, and xpx.
Constraints
,,。
Notes
Translated from COCI2013-2014 CONTEST #6 T5 HASH.
Translated by ChatGPT 5