prob005, 1 optimization