Applied Programming HW#2, Optimization Problem