int is 4 bytes and long is 8 bytes.. and, we know that 'int' a little(relatively) more than 2x10^9 and 'long' is a little more than 9x10^18 and in the constraints, its specifically mentioned that "The answer will never exceed 1018" , so long will do... and make sure that the arithmetic in between is also longs, to be safe. - AK
On Sun, Sep 13, 2009 at 6:59 PM, Grant Kot <[email protected]> wrote: > I wish there was a way to catch these overflows maybe with a try catch, or > is there? I'm using C#, I'm just wondering how you guys decide the size of > the data, like whether to use int or long or maybe even BigInteger. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
