c++ 009 solution, ptimes