Solution to the MaxDoubleSliceSum in C++98