Box It!

  • + 0 comments

    IF YOU SUCCEED AT ALL EXCEPT ONE TEST CASES, READ THIS POST: With one of the test cases, the numbers are so large that even with a line like this (which seems fine)...

    long long CalculateVolume() { return l * b * h; };

    ...The result of this, while converted to a long long eventually, is originally in integer format during multiplication, causing overflow hence producing a negative volume!

    I don't know if there's a more elegant way to do this, but I just decided to do it this way and it worked. long long CalculateVolume() { return (long long) l * (long long) b * (long long) h; };