Project Euler 297

http://projecteuler.net/index.php?section=problems&id=297


最初、問題取り違えてた。
ちょっと考えれば簡単。メモ化使って3msecだった。