Hi,
The contest analysis for the 2012-Qual-Round, gives the solution approach
for "Problem C - Recycled Numbers"
It apparently, is an "iterate over A to B" solution, which I presume will
work in the stipulated time for both small and large input
Is there a smarter way of solving the problem, without needing to iterate
over "A to B"
I had thought over the following approximate algorithm, but it doesn't work
for all cases, hence didn't solve it
----------------
find number of digits in A and B --> no_of_digits
find the number of different types of rotations possible --> 1 digit
rotation, 2 digit rotation, 3 digit rotation ... (no_of_digits-1) rotation
--> rotation_type = no_of_digits-1
Running for-loop over rotation_type
Select first digit in "r" ways as per restrictions of "A" and "B"
(Thisis not so straight forward for the 4th example case)
Select another digit (which on rotation will become the first digit) in
"r" ways
The other (no_of_digits-2) digits will be selected in
10^(no_of_digits-2) ways
Remove repetition cases. (I could not formulate this accurately)
----------------
Thanks and Regards
Khalil Sawant
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-code/-/_LgLrW3KJVkJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-code?hl=en.