用BFS思想实现,不用递归 #include <iostream> #include <queue> using namespace std; int main() { int n, m; while (scanf("%d %d", &m, &n) != EOF) { if(m==0 && n==0){ break; } int total = 0; queue<int> myQueue; ...