Problem C
Hamming Ellipses
In geometry, ellipses are defined by two focal points
When one normally thinks of ellipses, it is in the context of the Euclidean 2D plane, with the Euclidean distance as a distance measure.
This problem explores a different kind of ellipse. The space
we will work in is the space of words of length
For a distance measure, we use the Hamming
distance. The Hamming distance between two words
Within the space
Input
The first line contains three integers
The second and third lines specify the two focal points
Output
Output one line containing a single integer, denoting the number of points on the ellipse.
The input is chosen such that the answer is less than
Sample Input 1 | Sample Output 1 |
---|---|
3 5 9 01201 21210 |
24 |
Sample Input 2 | Sample Output 2 |
---|---|
4 6 5 123031 231222 |
0 |
Sample Input 3 | Sample Output 3 |
---|---|
2 32 32 01010101010101010101010101010101 01010101010101010101010101010101 |
601080390 |