On Monday, May 13, 2013 8:44:09 PM UTC+3, Vaibhav Tulsyan wrote: > @Stanislav : I am using 1.7.0, so that's not an issue. The main problem is > that substring( ) takes only int parameters(not even long, forget about > taking BigInteger objects). Does C++ have a similar function?
10^6 fits easily into an int, so holding the input in a String object and using String.substring(int, int) is in no way a problem. The only place where you really need a long for the variable where you accumulate the answer. The solution you described, however, will not finish running within your lifetime if you give it a 10^6 character long string as input. -- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msg/google-code/-/WZ7ZTkesRWsJ. For more options, visit https://groups.google.com/groups/opt_out.
