Solve AOJ1166
Solve AOJ2014