You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
455 B
24 lines
455 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
bool isQm(int x) {
|
|
int t = x;
|
|
while (t) {
|
|
int a = t % 10;
|
|
if (a > 0 && x % a > 0) return false;
|
|
t /= 10;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
int main() {
|
|
int n, m;
|
|
cin >> n >> m;
|
|
int cnt = 0;
|
|
for (int i = n; i <= m; i++)
|
|
if (isQm(i)) {
|
|
cout << i << " ";
|
|
cnt++;
|
|
}
|
|
if (cnt == 0) cout << -1;
|
|
return 0;
|
|
} |