Problem 004, C++