Problem 005, C++