Source Code
Lesson Learned:
This program algorithm is simple. However, I still meet one problem: edge condition(N, M both are zero). After writting the pseudocode, I should always check algorithm for the edge conditions of the input parameters. This is just a small effect, but helps to eliminate high risk bugs!
转载于:https://www.cnblogs.com/jeffreytan/archive/2008/06/28/1231568.html