A Very Big Sum

  • + 9 comments

    This was not the case in C++ if you're using accumulate().

    long long int total = accumulate(arr.begin(),arr.end(), 0);
    

    which appears to overflow. I just iterated through the elements in a loop and summed the total instead.