minor changes
minor changes
minor changes
minor changes

refactoring via jidea inspector
minor changes

refactoring via jidea inspector
Logic correct

Now program's result equals manual result. Yahoo!