Algorithm/Problem Solving [C++] 0