上面两个题目的思路和Python源码,
http://blog.csdn.net/u014606206/article/details/77596819