Yes, but 2^60 > 10^18, so it is enough. On Tue, Sep 15, 2009 at 5:36 AM, Hawston LLH <[email protected]> wrote:
> long long is 8 byte = 64 bits only. > > > On Mon, Sep 14, 2009 at 9:40 PM, Ken Corbin <[email protected]> wrote: > >> >> 64 bit longs start to overflow about 10**18. Java has a BigInteger >> infinite >> precision integer class that I've use in a couple of these problems when >> computations start approaching that size. The C++ code I've looked at >> used >> long long variables which I think are 128 bits. They are still going to >> overflow eventually, but apparently they are big enough to solve all code >> jam >> problems. >> >> For some problems, like Next Number in this round, you can just treat the >> number as a string an manipulate an array of digits. There is no need to >> turn it into a binary representation. >> >> Best regards, >> -Ken >> >> On Sunday 13 September 2009 22:17:10 Carlos Guia wrote: >> > Most likely overflow, 32bit integers will overflow in the large set. >> > Carlos Guía >> > >> > On Sun, Sep 13, 2009 at 11:56 PM, Seedrick <[email protected] >> >wrote: >> > > hi!! >> > > >> > > i used the exaclty same logic.... >> > > and got the small input correct but the large one wrong... >> > > >> > > What could be the problem with this logic? I have tried all sorts of >> > > possible cases but could not figure this out. >> > > >> > > On Sep 13, 4:50 pm, Ketan Joshi <[email protected]> wrote: >> > > > Hi, >> > > > I used the below logic to solve this: >> > > > >> > > > 1) find number of unique chars in the input number. This becomes the >> > > > base >> > > >> > > in >> > > >> > > > which it will have lowest value. >> > > > 2) assign '1' to first char >> > > > 3) assign '0' to second unique char that appears in the input num >> > > > 4) assign 2..base-1 to each unique char that appears in the input in >> > > > the increasing order >> > > > -- So cats becomes 1023 and zig becomes 102 >> > > > 5) result = 0; >> > > > for (i=0;i++;i<length of num){ >> > > > result = result * base + number representing char[i]} >> > > > >> > > > output result. >> > > > >> > > > This logic worked fine for small input. But I got "incorrect" >> response >> > > >> > > for >> > > >> > > > large input. >> > > > Can someone tell me if this logic is flawed in any sense? >> > > > >> > > > Regards, >> > > > KeJo >> > > > >> > > > -- >> > > > Blog:http://beingkejo.wordpress.com >> > >> > >> >> >> >> >> >> > > > > -- Best regards, Дектярев Михаил --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
