Project Euler 360(4)

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

フォーラムの方法で雑に組んだら確かに20秒になった。明日こそPriorityQueueを使ってみよう。