The maximum length of string in problem C is 500. You can see in
sample I/O that 8 repeated characters (wweell..) = 2^8 possibilities.
They can put string like this in large data set, and you would need
huge variable to store the value (128 bits). So, you modulo divide
your result every time you increase it.

This is standard dynamic programming problem, you can read about
solution in the "Contest Analysis". I sometimes make off-by-one
errors, so instead of using 2D array, I assigned map to every
character of the string and wrote recursive function which takes
string and returns number of 'substrings'. You can take a look at my
code (Place 1630, "Krzychoo", C++), usage of map made it quite easy to
understand.

On Sep 4, 5:07 pm, Satyajit Malugu <[email protected]> wrote:
> Ken:I guess most of the programmers that do in C/C++ learned it in school
> and did several years in them. Books like Ritch & Kenni etc  would be their
> best friends.
>
> They are so experienced that they can program without exceptions and stuff
> that we are used to in our day to day programming (at software companies).
>
> But yeah, I've seen top 5-6 contestants all of them used cpp. And no
> regex's. Also, can you tell me your position so that I can see your code?
>
> Dhruv: I tried Ruby and regex's but failed miserably. Apparently we
> shouldn't venture a new programming language for the contest ;) So shifted
> back to java and normal string parsing and was able to solve.
> Though many have done it, I still congratulate you on finding a regex
> solution. Kudos
>
> Can any explain what the meaning of %10000 and 2D cache in the third problem
> that all the contestants used? I think I missed that big time and hence
> couldn't solve it though i got the recursive idea.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to