Finish Poj 2389

http://www.cnblogs.com/mobileliker/p/4095425.html