vector<int> selfDividingNumbers(int left, int right) { vector<int> V; for (int i = left; i <= right; i++) { //将数字分解 int temp = i; if (i >= 1 && i <= 9) { V.push_back(i); continue; } bool tag = true; while (temp != 0) { int a = temp / 10; int b = temp % 10; if (b == 0) { tag = false; break; } if (i%b != 0) { tag = false; break; } temp = a; } if (tag)//此值可以自除 { V.push_back(i); } } return V; }