Update p074.rb

Use cache. (about 25 sec.)