Here is the link to the Problem and Solution of December cook-off YVNUM.
There is one thing in this solution which i cant get my head around -
when the number becomes too big we take the modulo of the number wrt to 1000000007 instead of the original number and then do the concatenation operation with it rather than the original number and then expect the answer to be same, will it work??
Ex. string 921, modulo number = 103
921%103 = 97 but we find that (921219192)%103 != (977997)%103
Please tell me where am i wrong.
We first try to represent the number as sum of several numbers. Now, as the numbers become large, we take the modulo of the component numbers instead of the digits.
So, to find modulo of (921219192), we break it as
a = 921 * 10^6
b = 219 * 10^3
c = 192 * 10^0
So,921219192 = a + b + c
So, now the answer is (a%103+ b%103 + c%103)%103.
And I don’t think that just taking modulo of each cyclic shift and then concatenating it would work.