Problem 015, C++