modify the third problem in order to get computing efficiency.