728. 自除数
模拟即可
class Solution {
public:
bool check(int x) {
int y = x;
while (x)
{
int t = x % 10;
if (!t) return false;
if (y % t) return false;
x /= 10;
}
return true;
}
vector<int> selfDividingNumbers(int left, int right) {
vector<int> ans;
for (int i = left; i <= right; i ++ )
if (check(i))
ans.push_back(i);
return ans;
}
};